|
|
sybperl-l Archive
Up Prev Next
From: "Jain, Mohit S" <mohit dot jain at gs dot com>
Subject: Strange Error in DBD::Sybase v0.91
Date: Dec 16 2002 4:37PM
Folks,
I am using the DBD::Sybase module version 0.91. Sometimes (once a week) I
get the following sporadic errors. These errors are corrected when my
application is restarted.
&DBD::Sybase::db::_login called at
/opt/perl-5.004/lib/site_perl/DBD/Sybase.pm line 73.
(in cleanup) Driver has not implemented DESTROY for
DBI::db=HASH(0xb11a0c)"
I am enclosing the code snippet.
my ($dataserver,$query, $g) = @_;
print "QUERY = $query\n";
my ($cat1,$cat2,$cat3);
eval {
# Connect to database
my $dbh = DBI->connect("DBI:Sybase:server=$dataserver",
'$login','$passwd' ) || die "Couldnt connect to dataserver: " . DBI->errstr;
print "CONNECTED TO $dataserver\n";
# Prepare SQL Statement
my $sth = $dbh->prepare('select C, C2,C3 from where
G != null and G = ?') || die "Couldnt prepare the statement:" .
$dbh->errstr;
# Execute the statement
$sth->execute($query) or die "Couldnt execute the statement
" . $sth->errstr;
# Iterate thru the resultset
while (my @data = $sth->fetchrow_array()) {
$cat1 = $data[0];
$cat2 = $data[1];
$cat3 = $data[2];
}
# close Statement handle
$sth->finish;
# Check if ResultSet returned any data
if ($cat1) {
# if yes disconnect the Database handle
$dbh->disconnect;
}
else {
# If didn't return any data then run additional
queries
$sth = $dbh->prepare('select a, b, c, d from
where g = ? ) || die "Could prepare the 3rd database st
atement " . $dbh->errstr;
$sth->execute($g) or die "Could not execute " .
$dbh->errstr;
while (my @data2 = $sth->fetchrow_array()) {
# some additional logic
}
$dbh->disconnect();
}
};
if ($@) {
print STDERR "Didnt find Categories $@".localtime()."\n";
die $@;
}
Any help would be appreciated.
Mohit S. Jain
ET Applications Development
Phone (212) 855-0251
Fax (212) 493-0170
Email mohit.jain@gs.com
|