On Fri, Jun 13, 2003 at 11:43:36AM +0100, Martin J. Evans wrote:
> Hi,
>
> Just noticed this problem when my database was down:
>
> #!/usr/bin/perl -w
> use DBI;
> my $dbh = DBI->connect("dbi:ODBC:testviagamb",
> "Fred",
> "Bloggs");
>
> Use of uninitialized value in concatenation (.) or string at
> /usr/lib/perl5/site_perl/5.6.1/i686-linux/DBI.pm line 584.
> DBI connect('testviagamb','Fred',...) failed: at ./con.pl line 6
$drh->errstr is returning undef:
> >> connect DISPATCH (DBI::dr=HASH(0x81bb28c) rc2/3 @5 g0 ima1
> pid#32637) at /usr/lib/perl5/site_perl/5.6.1/i686-linux/DBI.pm line 582
> -> connect for DBD::ODBC::dr (DBI::dr=HASH(0x81bb28c)~0x80fd0a8
> 'doesnotexist' 'Fred' **** HASH(0x81858d8))
> <- connect= undef at /usr/lib/perl5/site_perl/5.6.1/i686-linux/DBI.pm line 582
No error has been recorded on the driver handle.
> >> errstr DISPATCH (DBI::dr=HASH(0x81bb28c) rc2/3 @1 g0 ima4
> pid#32637) at /usr/lib/perl5/site_perl/5.6.1/i686-linux/DBI.pm line 584
> -> errstr in DBD::_::common for DBD::ODBC::dr
> (DBI::dr=HASH(0x81bb28c)~0x80fd0a8)
> <- errstr= undef at /usr/lib/perl5/site_perl/5.6.1/i686-linux/DBI.pm line 584
so errstr is undef.
> -> DESTROY for DBD::ODBC::db (DBI::db=HASH(0x818592c)~INNER)
> DESTROY for DBI::db=HASH(0x818592c) ignored - handle not initialised
> error: -1 '[unixODBC][Driver Manager]Data source name not found, and no
> default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1)'
> <- DESTROY= undef at /usr/lib/perl5/site_perl/5.6.1/i686-linux/DBI.pm line 639
> via ./con.pl line 4
Looks like the error was recorded on the dbh that was being created,
not the drh it was being created from. Looks like a DBD::ODBC bug.
Tim.