Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I get the following error when trying to use DBI:Pg
install_driver(Pg) failed: Can't load '/usr/lib/perl5/vendor_perl/5.8. +0/i386-linux-thread-multi/auto/DBD/Pg/Pg.so' for module DBD::Pg: libp +q.so.2: cannot open shared object file: No such file or directory at +/usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229. at (eval 7)[/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/ +DBI.pm:597] line 3 Compilation failed in require at (eval 7)[/usr/lib/perl5/vendor_perl/5 +.8.0/i386-linux-thread-multi/DBI.pm:597] line 3. Perhaps a required shared library or dll isn't installed where expecte +d at dbusers line 6 DBI::install_driver('DBI','Pg') called at /usr/lib/perl5/vendo +r_perl/5.8.0/i386-linux-thread-multi/DBI.pm line 497 DBI::connect('DBI','DBI:Pg:dbname=shop1','','') called at dbus +ers line 6
The code is:
#!/usr/bin/perl -w use strict; use DBI; # Connect to the database my $dbh = DBI->connect('DBI:Pg:dbname=shop1', '', '') or die "Couldn't open database: '$DBI::errstr'; <br>stopped"; $dbh->do("CREATE TABLE users (uid INT, login CHAR(8))"); $dbh->disconnect;
~ I am very new to this any help will be greatly appreciated. Lewie

Edited by Chady -- added code tags.

Replies are listed 'Best First'.
Re: using DBI to connect to postgres
by Fletch (Bishop) on Jun 17, 2004 at 18:36 UTC

    Looks like you don't have the postgres shared libraries installed. Going by the paths it looks like you're possibly on some form of RedHat so make sure the postgresql-libs rpm is installed.

Re: using DBI to connect to postgres
by sweetblood (Prior) on Jun 17, 2004 at 18:53 UTC