Click to See Complete Forum and Search --> : Can't call method "do" on an undefined value


angelesj
02-13-2003, 04:10 PM
Hello...
I'm getting this message "Can't call method "do" on an undefined value" when trying to connect to Sybase database using CGI.. this is some parts of the code i have. The code works in one machine but it doesn't work with a different machine. Do you know what would cause this error or what could be different between the machines?

Thanks,
Jen

use DBI;
use CGI;
my $dbh;
.......

$ENV{'SYBASE'} = "/opt/sybase/" unless (defined $ENV{'SYBASE'});
...................

eval {
$dbh=DBI->connect("dbi:Sybase:server=$DATA_SOURCE", $USERID, $PWD);
};
if( DBI::errstr eq "")
{

$dbh->do("use TOPAZ");

...........

jeffmott
02-15-2003, 08:13 AM
If the code has stayed the same then obviously there must be some difference in the configuration between the two systems. Do they both have Sybase? Are they both configured the same way?

Nedals
02-15-2003, 06:44 PM
I'm not familiar with Sybase, only mySQL but it would appear that 'dbi' in this line should be uppercase. I would guess that you never connect to the database.
$dbh=DBI->connect("DBI:Sybase:server=$DATA_SOURCE", $USERID, $PWD);