DBI connect returning an empty hash

From: Scott Cain <cain(at)cshl(dot)edu>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: DBI connect returning an empty hash
Date: 2006-04-06 16:34:22
Message-ID: 1144341262.28535.162.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi all,

I am developing a perl module that, when it is created, establishes a
DBI connection to my postgresql database. The problem I am having is
that when I issue a DBI->connect command, the database handle it returns
is empty (Data::Dumper shows it as an empty hash). Here is my code:

sub new {
my $class = shift;
my %arg = @_;

my $self = bless {}, ref($class) || $class;

my $dbname = $arg{dbname};
my $dbport = $arg{dbport};
my $dbhost = $arg{dbhost};
my $dbuser = $arg{dbuser};
my $dbpass = $arg{dbpass};
my $notrans= $arg{notransact};

warn $dbname,$dbport,$dbhost;
warn $dbuser,$notrans;

my $dbh = DBI->connect(
"dbi:Pg:dbname=$dbname;port=$dbport;host=$dbhost",
$dbuser,
$dbpass,
{AutoCommit => $notrans,
TraceLevel => 4}
) or die;

warn Dumper($dbh);

...etc...

The trace output doesn't show anything strange, and DBI.pm at least
seems to think things went OK, because it doesn't `die` on that line.

I wrote a simple test script that does exactly the same thing, and it
works. Does anyone have any suggestions for what might be going on
here?

Thanks,
Scott

--
------------------------------------------------------------------------
Scott Cain, Ph. D. cain(at)cshl(dot)edu
GMOD Coordinator (http://www.gmod.org/) 216-392-3087
Cold Spring Harbor Laboratory

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Scott Cain 2006-04-06 18:04:59 Re: DBI connect returning an empty hash
Previous Message Greg Sabino Mullane 2006-04-06 03:03:29 DBD::Pg version 1.48 released