fetchrow_array warning and error in cleanup


Happy New Year to you all,

I am quite new to using DBI and am running into something odd.

I'm using Perl 5.6.0 build 623 (Activestate), DBI 1.48 and DBD-ORACLE
1.12 on a Windows XP box. Not exactly the newest versions, I know, but
the company I work for is quite paranoid when it comes to using "new"
software, so I'm afraid that I'm stuck with these versions.

On my PC I have installed Oracle Client 10.1 and I am connecting to a
database server running Oracle 10g. The connection works fine and I can
perform queries.

So far so good. The issue is that at the end of each query, after that
last record has been fetched, I get the following warning:

DBD::Oracle::st fetchrow_array warning: (err=3D0, errstr=3Dundef,
state=3Dundef) at C:\<path_to_script>.pl line <linenumber>.

Then at the very end of the script, even after the disconnect, I get:

(in cleanup) Can't call method "FETCH" on an undefined value at
C:/Perl/site/lib/Win32/TieRegistry.pm line 1486 during global
destruction.


Stripped down to the bare minimum the script looks like this:

use DBI;

my $datasource =3D "dbi:Oracle:mydatabase";
$user=3D'myuser';
$password=3D'mypassword';

$dbh =3D DBI->connect($datasource, $user, $password) or die =
"Couldn't
connect to database: " . DBI->errstr;

$sql =3D q{
SELECT col_a, col_b
from mytable
};

$sth =3D $dbh->prepare($sql);

$sth -> execute;

while (my [at] results =3D $sth->fetchrow_array()) {
print "$results[0], $results[1]\n";
}

$sth->finish;

$dbh->disconnect;

I'm lost. The database connection and queries seem to be working fine,
but the warnings are extremely annoying.
Any help would be highly appreciated.

Best regards,
Kees Couprie
Kees.COUPRIE [ Fr, 04 Januar 2008 10:13 ] [ ID #1900040 ]

Re: fetchrow_array warning and error in cleanup

On Fri, Jan 04, 2008 at 10:13:52AM +0100, COUPRIE Kees wrote:
>
> I'm using Perl 5.6.0 build 623 (Activestate), DBI 1.48 and DBD-ORACLE
> 1.12 on a Windows XP box. Not exactly the newest versions, I know, but
> the company I work for is quite paranoid when it comes to using "new"
> software, so I'm afraid that I'm stuck with these versions.

> So far so good. The issue is that at the end of each query, after that
> last record has been fetched, I get the following warning:
>
> DBD::Oracle::st fetchrow_array warning: (err=0, errstr=undef,
> state=undef) at C:\<path_to_script>.pl line <linenumber>.

That's a harmless warning caused by DBD::Oracle being too old relative to DBI.
Workaround by setting PrintWarn dbh attribute false.

> Then at the very end of the script, even after the disconnect, I get:
>
> (in cleanup) Can't call method "FETCH" on an undefined value at
> C:/Perl/site/lib/Win32/TieRegistry.pm line 1486 during global destruction.

Old problem. I can't remember off-hand if upgrading DBI, or
Win32::TieRegistry will help. Check the archives.

Tim.
Tim.Bunce [ Fr, 04 Januar 2008 12:16 ] [ ID #1900041 ]
Perl » perl.dbi.users » fetchrow_array warning and error in cleanup

Vorheriges Thema: installing DBD-Oracle-1.19
Nächstes Thema: ORACLE DRIVER