4 Replies Latest reply on Oct 29, 2019 5:36 AM by MunKeong Lee

    connexion postgresql / perl

    nicolas castel
      Share This:

      Hi

       

      i m facing a problem with perl script adaptation where i have to connect on Postgresql database using ODBC connection

       

      my $dbServer = "SVTFRCTM01";

      my $dbName = "EMDB";

      my @drivers = DBI->available_drivers;

      print join(", ", @drivers), "\n";

       

      my $dsn = 'dbi:ODBC:Driver={PostgreSQL30}';

      $dbh = DBI->connect("$dsn;Server=$dbServer;Database=$dbName;Trusted_Connection=yes", { RaiseError => 1, AutoCommit => 1 }) || messageLog("Error", "Database connection not made: $DBI::errstr");

      print "\n affichage de la commande psql : ".$dbh;

       

       

      nevertheless when i try do do this i obtain this following message

       

       

      install_driver(Pg) failed: Can't load 'C:/Adminsouf/souffletPerl/perl/vendor/lib/auto/DBD/Pg/Pg.dll' for module DBD::Pg: load_file:\

      The specified module could not be found at C:/Adminsouf/souffletPerl/perl/lib/DynaLoader.pm line 190.

      at C:/Adminsouf/souffletPerl/perl/minimal/PAR/Heavy.pm line 95.

      Compilation failed in require at (eval 48) line 3.

      Perhaps a required shared library or dll isn't installed where expected

      at C:\Adminsouf\ctm\vbs.pl line 109.

       

      we use postgré version 9.5

       

      i cannot add any DSN in ODBC administrator consol , i have an error message like this one =>

      The setup rouines for the BMC ODBC for PostgreSQL ANSI (Default) ODBC driver could not be loaded due to system error code 126: the specified module could not be found .(C:\Program Files\BBMC Software\Control-M EM\Default\pgsql\bin\PSQLODBC30A.DLL).

       

      so if somebody can help me ,  thank you in advance

        • 1. Re: connexion postgresql / perl
          MunKeong Lee

          Hi Nicolas:

          Please do the following:

          1. Add C:\Program Files\BMC Software\Control-M EM\Default\pgsql32\bin to the Path system environment variable. The required Postgres DLLs are located in this folder. Adding it will enable the Perl module to locate them.

          2. The Postgres client that comes with EM is 32-bit. Make sure you are using 32-bit Perl.

          3. Use ODBC Data Sources (32bit) to add Data Source.

           

          You may want to take note of the following points as well:

          1. It's not necessary to use ODBC. You can make of DBI like this:

          my $dbh = DBI->connect('dbi:Pg:dbname=emdb;host=SVTFRCTM01;port=5432','emuser','password',{AutoCommit=>1,RaiseError=>1,PrintError=>0});

          2. Look like you are using another installation of Perl. This should work fine. However BMC provided Perl in C:\Program Files\BMC Software\Control-M EM\Default\bmcperl folder as well.

           

          Regards,

          MK

          2 of 2 people found this helpful
          • 2. Re: connexion postgresql / perl
            nicolas castel

            thank you for your kind answer

            • 3. Re: connexion postgresql / perl
              nicolas castel

              hi ,  i just tried but it doesn't work =>

              install_driver(Pg) failed: Can't load 'C:/Adminsouf/souffletPerl/perl/vendor/lib/auto/DBD/Pg/Pg.dll' for module DBD::Pg: load_file:\

              The specified module could not be found at C:/Adminsouf/souffletPerl/perl/lib/DynaLoader.pm line 190.

              at C:/Adminsouf/souffletPerl/perl/minimal/PAR/Heavy.pm line 95.

              Compilation failed in require at (eval 48) line 3.

              Perhaps a required shared library or dll isn't installed where expected

              at C:\Adminsouf\ctm\vbs.pl line 118.

              • 4. Re: connexion postgresql / perl
                MunKeong Lee

                Hi

                Where did you obtain your Perl installation? I suspect that DBD:Pg (PostgreSQL database driver for the DBI module) may not be installed. You may need to install it separately. The easiest way to overcome this is to use the perl that come installed together with Control-M. It's already pre-installed with DBD:Pg.

                 

                Regards,

                MK