D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] how to use perl DBI?

 

On Fri, 25 Mar 2005 17:17:58 +0000, James Keasley
<jamesk@xxxxxxxxxxxxx> wrote:

dave morgan <morgad@xxxxxxxxxxxxx> writes:
[snip]
DBI->connect(ntp-stats) failed: missing "=" after "ntp-stats" in
connection info string at ./test4.pl line 8
Can't call method "disconnect" on an undefined value at ./test4.pl
line 10.

You are using the wrong syntax, the perl DBI interface for Postgres
is subtly different from the MySQL interface.

Instead use: -

my $dbh = DBI->connect("DBI:pg:dbname=$mydb", $user, undef) or 
 die("Can't open db connection:$!\n");


<simpsonmode="homer">
 Doh!
</simpsonmode>

Thanks James :-)

Dave
-- 
http://www.morgad.no-ip.info/index.html    gpg:0x64B5E037 
Distributed Proofreaders: http://www.pgdp.net
The NTP server pool http://www.pool.ntp.org

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe. FAQ: www.dcglug.org.uk/linux_adm/list-faq.html