Silencing DBI "(err=0, errstr=undef, state=undef)" errors

Silencing DBI "(err=0, errstr=undef, state=undef)" errors

am 22.12.2005 10:31:57 von david

List,

I have an $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. Yes, I have a
valid license (although we are talking about 8.1.7 here). I don't fancy
compiling a perl myself for this box.

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";
[download]

.... but it appears that my handlers here are not called by anything, and
I still get the errstr=undef spew.

I have also tried scoping the error in a 'no warnings' block. And I'd
rather not have to diddle with $SIG{__WARN__}.

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.

David
--
"It's overkill of course, but you can never have too much overkill."

Re: Silencing DBI "(err=0, errstr=undef, state=undef)" errors DBD::Oracle

am 23.12.2005 12:46:31 von Tim.Bunce

On Thu, Dec 22, 2005 at 10:31:57AM +0100, David Landgren wrote:
> List,
>
> I have an $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. Yes, I have a
> valid license (although we are talking about 8.1.7 here). I don't fancy
> compiling a perl myself for this box.

I believe ActiveState are now shipping a pre-built DBD::Oracle
with an installer that will automatically download Oracle Instant Client.
(Say yes when prompted, even if you have IC installed already.)

> 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.

That was fixed in 1.16. The Changes file says:

Fixed setting of $DBI::err to 0 triggering PrintWarn in DBI >= 1.41.

Tim.