develooper Front page | perl.dbi.users | Postings from January 2008

fetchrow_array warning and error in cleanup

Thread Next
From:
COUPRIE Kees
Date:
January 4, 2008 01:14
Subject:
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=0, errstr=undef,
state=undef) 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 = "dbi:Oracle:mydatabase";
    $user='myuser';
    $password='mypassword';
    
    $dbh = DBI->connect($datasource, $user, $password) or die "Couldn't
connect to database: " . DBI->errstr;
    
    $sql = q{
        SELECT col_a, col_b
          from mytable
    };
    
    $sth = $dbh->prepare($sql);
    
    $sth -> execute;
    
    while (my @results = $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

Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About