Subject: | DBI failed to catch DBD::Oracle exception |
Date: | Wed, 26 Apr 2006 17:27:01 +1200 |
To: | bugs-DBI [...] rt.cpan.org |
From: | Herman KALL <Herman.KALL [...] team.telstraclear.co.nz> |
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.
Hi,
i am having a problem with DBI API which doesn't catch an error when using the database object handle in a hash reference.
Thanks,
Herman
The problem:
Oracle exceptions don't get caught by the DBI when using a hash reference for the Database handle object returned from the DBI connect method.
The calling program stops when executing a SQl statement that throws an Oracle exception.
The DBD writes out the Oracle error message to STDOUT.
The DBI does not catch the error and therefore the control doesn't go back to the calling program.
This has a critical impact on cgi-scripts which just die and show a 'page not found' error on the browser screen.
test.pl does establish an Oracle DBI connection and stores the database handle Object into an Object reference( hash ref)
Then it executes an insert statement which will throw an Oracle exception.
running test.pl does show the error message "DBD::Oracle::st execute failed: ORA-00936: missing expression (DBD ERROR:..."
on screen.
It does not show the DBI error message nor does the control flow come back to the test.pl program.
test_ok.pl does establish an Oracle DBI connection and stores the database handle object into a scalar variable.
Then it executes an insert statement which will throw an Oracle exception.
running the test_ok.pl script shows both the DBD error message AND the DBI error message.
The control flow of the program doesn't stop after catching the error.
environment:
perl 5.8.6 on Solaris
DBD/Oracle 1.17
DBI 1.50
Oracle 10g client ( client library)
Oracle 8i database
was working in the following environment:
perl 5.003 on Solaris
DBD/Oracle 0.39
DBI 0.73
Oracle 7.2.2 client ( client library)
Oracle 8i database
attached scripts:
perlbug_out.txt
test.pl
test_output.pl
test_ok.pl
test_ok_output.pl
Database.pm
<<test_output.txt.txt>> <<test_ok_output.txt.txt>> <<perlbug.out.txt>> <<test.pl.txt>> <<test_ok.pl.txt>> <<Database.pm>>