Hello,

I have a program in perl running on Linux, accessing a SQL Server database 
via ODBC. It runs fine. But yesterday, the process had been running for six 
days when suddenly, one specific select statement/fetchrow_hashref stopped 
returning any data from the database. There were other very similar lines of 
code that were still returning data. Just this one particular statement was 
not. A manual restart of the perl process fixed the problem. And everything 
is still working fine since then.

Reliability is important here, so I need to address this, but it's tough 
because I don't know how to replicate it.

Any ideas/advice?

Here is the code that was failing (throws an exception):
-------------------------------------------------------------------
# Get partner info.
my $sql = "
SELECT *
FROM Partners
WHERE PartnerCode = $partnerCode
";
my $sh = $dbh->prepare($sql) || throw util::backEndException -value => {code 
=> code('DATABASE_ERROR'), message => $dbh->errstr};
$sh->execute || throw util::backEndException -value => {code => 
code('DATABASE_ERROR'), message => $sh->errstr};
my $partnerInfo = $sh->fetchrow_hashref('NAME_lc');
$sh->finish;
if (!$partnerInfo) {
throw util::backEndException -value => {code => code('DATABASE_ERROR'), 
message => "Unexpected error looking up partner for $item"};
}
-------------------------------------------------------

It's the check for $partnerInfo that fails. And prior to this code, 
"$partnerCode" is checked, so the SQL code should be correct.

Thank you for any ideas,
April

Reply via email to