grinder has asked for the wisdom of the Perl Monks concerning the following question:

I have a big $application that uses Oracle on Windows 2000, and I speak to the database with ActiveState Perl 5.6, since 5.6 is the last version for which Oracle allows AS to package DBD::Oracle. This reason, as much as anything else, precludes me from upgrading to 5.8. I had to upgrade DBI a while ago, because I was running into problems with DBD::Proxy that have been resolved in more recent versions. Everything is now working correctly, except that I am getting the following non-error warnings:

DBD::Oracle::db selectall_arrayref warning: (err=0, errstr=undef, state=undef) at foo.pl line 666.

It's a non-error: it's basically saying "hey! everything's ok! hope you're happy about that!" and it's making my life a misery because my log files are filling up with ten of thousands of these statements. I have tried setting all sorts of incantations in the creation of database handles, such as setting RaiseError and PrintError to zero. I had high hope for the HandleError and HandleSetErr attributes. Poking about in the DBI.dll, it looks like the above err=... errstr=... state... string is belongs to the default HandleSetErr handler. I created a connection thusly:

$db = DBI->connect( $base, $user, $pw, { AutoCommit => 0, PrintError => 0, HandleError => sub { print "error handler <@_>\n"; return 0 } +, HandleSetErr => sub { print "seterr handler <@_>\n"; return 0 +}, }) or croak "Could not connect to database $base: ${\DBI->errstr}\ +n";

... but it appears that my handlers here are not called by anything, and I still get the errstr=undef spew. Is there something wrong with my handlers, or do I need to do something differently, or do something else? Thanks for any clues I can use.

• another intruder with the mooring in the heart of the Perl

Replies are listed 'Best First'.
Re: Silencing DBI "(err=0, errstr=undef, state=undef)" errors
by holli (Abbot) on Dec 20, 2005 at 11:06 UTC
    since 5.6 is the last version for which Oracle allows AS to package DBD::Oracle.
    That doesn't mean, you cannot use the DBI with Oracle and Perl 5.8. It does only mean that you have to copy the Oracle.dll from your (hopefully licenced) Oracle CD to \perl\site\lib\auto\DBD\Oracle install the Oracle client manually.


    holli, /regexed monk/
Re: Silencing DBI "(err=0, errstr=undef, state=undef)" errors
by Akhasha (Scribe) on Dec 21, 2005 at 03:00 UTC
    Maybe try something like:
    local $SIG{__WARN__} = sub { unless ($_[0] =~ /\(err=0, errstr=undef, state=undef\)/) { warn $_[0]; } };
    A tad icky I know...
Re: Silencing DBI "(err=0, errstr=undef, state=undef)" errors
by jZed (Prior) on Dec 20, 2005 at 18:32 UTC
    I don't think HandleError will be any help - it's for errors, not warnings. I'm surprised PrintError=0 doesn't work. Maybe time for a dbi-users@perl.org posting.
Re: Silencing DBI "(err=0, errstr=undef, state=undef)" errors
by Anonymous Monk on Dec 20, 2005 at 11:58 UTC
    Hello,

    maybe this helps
    ... eval { $sth = $dbh->prepare( $sqlstatement ); $sth->execute(); }; if ( $@ ) { warn "Database Error: $@\n"; } ...
    if not, try to trace it with DBI->trace{ $tracelevel } or DBI->trace{ $tl, $tracefile } ... to see what happens bye
    chris

    fixed formatting by holli