More experimentation reveals that this is possibly an artifact of mod_perl in 
Apache or some ENV issue since running an application on the command line on 
the same machine that has the following connection string works

my $lda = DBI->connect("dbi:Pg:$dbname", $login, $dbpass, {RaiseError=>1});



On Oct 27, 2023, at 1:39 PM, Johnson, Bruce E - (bjohnson) 
<john...@pharmacy.arizona.edu> wrote:

I am moving some web applications from Oracle to Postgres, and on one system 
I’m getting the following error:

[Fri Oct 27 13:25:19.725785 2023] [:error] [pid 98181:tid 98230] DBD::Pg 
initialisation failed: Can't locate object method "driver" via package 
"DBD::Pg" at /usr/lib64/perl5/vendor_perl/DBI.pm line 829.\n\nPerhaps the 
capitalisation of DBD 'Pg' isn't right. at 
/home/allwebfiles/perl/LocalModules/Cal4Defaults.pm line 49.\nCompilation 
failed in require at /home/allwebfiles/perl/LocalModules/Cal4HTML.pm line 
10.\nBEGIN failed--compilation aborted at 
/home/allwebfiles/perl/LocalModules/Cal4HTML.pm line 10.\nCompilation failed in 
require at /home/allwebfiles/perl/roomgrid.pl line 8.\nBEGIN 
failed--compilation aborted at /home/allwebfiles/perl/roomgrid.pl line 8.\n

Thing is this is the second server I'm working on, and the first is pretty much 
identical

Both are Rocky Linux 9.5 (a replacement for CentOS)

DBD::Pg was installed via cpan Bundle::DBD::Pg

PostgreSQL and DBI both come from the Rocky repositories

The line 49 in the .pm  in question is :

my $lda = DBI->connect("dbi:Pg:$dbname", $login, $dbpass, {RaiseError=>0, 
AutoCommit=> 1, PrintError =>1});

$dbname is ‘db=my_db_name;host=my_postgres_host;port=3542’ and is the same on 
the working system

All the references Ive found online regarding this error message were because 
DBD::Pg wasn’t installed which is not the case:

cpan[1]> i Bundle::DBD::Pg
Reading '/root/.cpan/Metadata'
  Database was generated on Thu, 26 Oct 2023 18:29:01 GMT
Bundle id = Bundle::DBD::Pg
    CPAN_USERID  TURNSTEP (Greg Sabino Mullane <g...@turnstep.com>)
    CPAN_VERSION 3.17.0
    CPAN_FILE    T/TU/TURNSTEP/DBD-Pg-3.17.0.tar.gz
    UPLOAD_DATE  2023-08-24
    MANPAGE      Bundle::DBD::Pg - A bundle to install all DBD::Pg related 
modules
    CONTAINS     DBI DBD::Pg
    INST_FILE    /root/.cpan/Bundle/DBD/Pg.pm
    INST_VERSION 3.17.0


Any ideas?



--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs



--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs


Reply via email to