Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DBD-Oracle CPAN distribution.


X-Scanned-BY: AMaViS-ng at bestpractical
X-Originalarrivaltime: 26 Apr 2006 05:27:02.0186 (UTC) FILETIME=[0C2678A0:01C668F2]
MIME-Version: 1.0
X-Spam-Status: No, hits=-6.3 required=8.0 tests=BAYES_00,DNS_FROM_RFC_ABUSE,FORGED_RCVD_HELO,HTML_MESSAGE,PERLBUG_CONF
Content-Class: urn:content-classes:message
Received-SPF: pass (x1.develooper.com: local policy)
X-Virus-Checked: Checked
Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C668F2.0BE449FB"
X-MS-Tnef-Correlator:
Received: from localhost (localhost.localdomain [127.0.0.1]) by diesel.bestpractical.com (Postfix) with ESMTP id C12AF4D80BB for <cpan-bug+dbi [...] diesel.bestpractical.com>; Wed, 26 Apr 2006 01:31:52 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 13CA24D80B8 for <bugs-DBI [...] rt.cpan.org>; Wed, 26 Apr 2006 01:31:51 -0400 (EDT)
Received: (qmail 4543 invoked by alias); 26 Apr 2006 05:31:40 -0000
Received: from smtp1.clear.net.nz (HELO smtp1.clear.net.nz) (203.97.33.27) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Tue, 25 Apr 2006 22:31:31 -0700
Received: from takasmtp2.telstraclear.tclad (takasmtp2.clear.co.nz [10.200.12.222]) by smtp1.clear.net.nz (CLEAR Net Mail) with SMTP id <0IYB00CPKDZSQN [...] smtp1.clear.net.nz> for bugs-DBI [...] rt.cpan.org; Wed, 26 Apr 2006 17:31:04 +1200 (NZST)
Received: FROM takexcowa01.telstraclear.tclad BY takasmtp2.telstraclear.tclad ; Wed Apr 26 17:27:02 2006 +1200
Received: from TDSEXC01.telstraclear.tclad ([10.201.12.96]) by takexcowa01.telstraclear.tclad with Microsoft SMTPSVC(6.0.3790.1830); Wed, 26 Apr 2006 17:27:02 +1200
Delivered-To: cpan-bug+dbi [...] diesel.bestpractical.com
Subject: DBI failed to catch DBD::Oracle exception
Return-Path: <Herman.KALL [...] team.telstraclear.co.nz>
Thread-Index: AcZo8gvMZCwxQpP2TJCMrm+2fYXetQ==
X-Original-To: cpan-bug+dbi [...] diesel.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Date: Wed, 26 Apr 2006 17:27:01 +1200
X-MS-Has-Attach:
Thread-Topic: DBI failed to catch DBD::Oracle exception
Message-Id: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad>
X-Mimeole: Produced By Microsoft Exchange V6.5.7226.0
To: bugs-DBI [...] rt.cpan.org
From: Herman KALL <Herman.KALL [...] team.telstraclear.co.nz>
Content-Length: 0
Content-Description: test_output.txt.txt
content-type: text/plain; charset="utf-8"; name="test_output.txt.txt"
content-disposition: attachment; filename="test_output.txt.txt"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: ascii
Content-Length: 4674

Message body is not shown because sender requested not to inline it.

Content-Description: test_ok_output.txt.txt
content-type: text/plain; charset="utf-8"; name="test_ok_output.txt.txt"
content-disposition: attachment; filename="test_ok_output.txt.txt"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: ascii
Content-Length: 3594

Message body is not shown because sender requested not to inline it.

Content-Description: perlbug.out.txt
content-type: text/plain; charset="utf-8"; name="perlbug.out.txt"
content-disposition: attachment; filename="perlbug.out.txt"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: ascii
Content-Length: 4272
Download perlbug.out.txt
text/plain 4.1k

Message body is not shown because sender requested not to inline it.

Content-Description: test.pl.txt
content-type: text/plain; charset="utf-8"; name="test.pl.txt"
content-disposition: attachment; filename="test.pl.txt"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: ascii
Content-Length: 749
Download test.pl.txt
text/plain 749b

Message body is not shown because sender requested not to inline it.

Content-Description: test_ok.pl.txt
content-type: text/plain; charset="utf-8"; name="test_ok.pl.txt"
content-disposition: attachment; filename="test_ok.pl.txt"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: ascii
Content-Length: 665
Download test_ok.pl.txt
text/plain 665b

Message body is not shown because sender requested not to inline it.

Content-Description: Database.pm
content-type: application/octet-stream; name="Database.pm"
content-disposition: attachment; filename="Database.pm"
Content-Transfer-Encoding: base64
Content-Length: 1834
Download Database.pm
text/x-perl 1.7k

Message body is not shown because sender requested not to inline it.

Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C668F2.0BE449FB"
Content-Length: 0
content-type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: iso-8859-1
Content-Length: 1989
Download (untitled) / with headers
text/plain 1.9k
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>>
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: iso-8859-1
Content-Length: 5258
MIME-Version: 1.0
In-Reply-To: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-10325-1161773339-1442.18926-0-0 [...] rt.cpan.org>
References: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 68
Moved to DBD::Oracle queue as I believe that's where the problem is.
MIME-Version: 1.0
In-Reply-To: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-27309-1165929985-1236.18926-0-0 [...] rt.cpan.org>
References: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 582
Download (untitled) / with headers
text/plain 582b
Looking at the latest version of DBD 1.19 I have traced back all the code to back to DBI and there is now bug that I can find. This might be a miss interprotaion of what RaiseError and PrintError will do If there is an SQL error and RaiseError is set to 0 then execution of the perl program will continue. If it is set to 1 it will throw a Perl error which can be trapped in an eval {}; I have tested the two scrips and the work (well don't work actually) for me as expected. Try your sripts with the same Raise and Print Error values and you will see how it works.
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-27309-1165929985-1236.18926-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Message-Id: <rt-3.6.HEAD-27313-1165931364-930.18926-0-0 [...] rt.cpan.org>
References: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad> <rt-3.6.HEAD-27309-1165929985-1236.18926-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1165931365-27313-1"
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 25
here are the files I used
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: multipart/mixed; boundary="----------=_1165931346-27281-5"
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: application/octet-stream; name="test_jps.pl"
Content-Disposition: inline; filename="test_jps.pl"
Content-Transfer-Encoding: base64
Content-Length: 930
Download test_jps.pl
text/x-perl 930b
# use DBI; require Database; my $database = Database::open_bill_database(); my $dbh = $database->dbh; my $sql_st = "insert into UPSTREAM_AUTHCD (NI102_SRC_FLG, NI102_AUTH_CD, NI102_SRC_NBR, NI102_TRAN_TYP, NI102_CREATE_TS, NI102_UNITS, NI102_PROD_CD, NI102_USERID, NI102_SID_CD) values ('A', $auth_cd, '0', 'E', 'sysdate', '0', '56', '$siteid', '0')"; #my $rv =($dbh->do ($sql_st)); # with Raise error set to 0 it will do the below If it is set to 1 it will not get below # if you wrap it in an Eval it will continue eval { my $rv =($dbh->do ($sql_st)); }; if ( $DBI::err ) { # it doesn'nt come here! print("\n\nCannot insert row: return_value = $rv $DBI::errstr\n"); } # neither it comes to here print("\n\n End of program: return code= $rv\n\n");
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1165931338-27298-10"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: text/plain; charset="utf-8"; name="Database_jps.pm"
Content-Disposition: inline; filename="Database_jps.pm"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: ascii
X-RT-Original-Encoding: utf-8
Content-Length: 1929
Download Database_jps.pm
text/x-perl 1.8k
################ # Database # ################ ################################################ ### Turn word wrap OFF to edit this file ### ################################################ # 9/10/96 Modified to work with DBI/DBD ( mSQL ) # This is a library of useful perl database routines # that use perl5 objects. package Database; require Version; require Debug; require DBI; sub open_test_database { my $user; my $password; $ENV{'ORACLE_HOME'} = '/oracle/share/product/10.2.0/client'; $ENV{'TNS_ADMIN'} = '/var/opt/oracle'; $user = 'nutst02'; $password = 'nutst02'; $ENV{'TWO_TASK'} = 'oratst4.external'; my $dbname = $ENV{'TWO_TASK'}; my $dbh = DBI->connect("dbi:Oracle:$dbname",$user,$password, {RaiseError =>1 ,AutoCommit =>1}) or $status=1; return($dbh); } sub open_bill_database { my $user = "nutst02"; my $password = "nutst02"; $ENV{'ORACLE_HOME'} = '/oracle/share/product/10.2.0/client'; $ENV{'TWO_TASK'} = 'oratst4.external'; $ENV{'TNS_ADMIN'}= '/var/opt/oracle'; my $dbname = $ENV{'TWO_TASK'}; $database = new Database( $dbname, $user, $password ); return( $database ); } # Create a new Database object sub new { my ( $class, $name, $user, $pwd ) = @_; #Debug::log("4712 $name - $user - $pwd"); my $dbh = DBI->connect( "dbi:Oracle:$name", $user, $pwd , { RaiseError =>0, AutoCommit => 1 } ); if ( $dbh ) { my $self = {}; bless $self; $self->{'dbh'}=$dbh; $self->{'name'}=$name; return( $self ); } else { Debug::on; Debug::backtrace; die "Cannot open $name database ( $name : $DBI::errstr)"; return( undef ); } } sub dbh { my ($self) = @_; return($self->{'dbh'}); } 1;
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1165931356-27162-2"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: application/octet-stream; name="test_ok_JPS.pl"
Content-Disposition: inline; filename="test_ok_JPS.pl"
Content-Transfer-Encoding: base64
Content-Length: 845
Download test_ok_JPS.pl
text/x-perl 845b
# use DBI; require Database; my $dbh = Database::open_test_database(); my $sql_st = "insert into UPSTREAM_AUTHCD (NI102_SRC_FLG, NI102_AUTH_CD, NI102_SRC_NBR, NI102_TRAN_TYP, NI102_CREATE_TS, NI102_UNITS, NI102_PROD_CD, NI102_USERID, NI102_SID_CD) values ('A', $auth_cd, '0', 'E', 'sysdate', '0', '56', '$siteid', '0')"; #my $rv =($dbh->do ($sql_st)); # with Raise error set to 0 it will do the below If it is set to 1 it will not get below # if you wrap it in an Eval it will continue eval { my $rv =($dbh->do ($sql_st)); }; if ( $DBI::err ) { print("\n\nCannot insert row: return_value = $rv $DBI::errstr\n"); } print("\n\n End of program: return code= $rv\n\n");
MIME-Version: 1.0
In-Reply-To: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-27293-1165931499-1269.18926-0-0 [...] rt.cpan.org>
References: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 14
closed for now
X-Originalarrivaltime: 13 Dec 2006 00:42:18.0323 (UTC) FILETIME=[8ACC1A30:01C71E4F]
MIME-Version: 1.0
X-Spam-Status: No, hits=-2.0 required=8.0 tests=BAYES_00,DNS_FROM_RFC_ABUSE,FORGED_RCVD_HELO,MIME_BASE64_NO_NAME
In-Reply-To: <rt-3.6.HEAD-27309-1165929985-1236.18926-6-0 [...] rt.cpan.org>
Content-Class: urn:content-classes:message
Received-SPF: neutral (x1.develooper.com: local policy)
Content-Type: text/plain; charset=UTF-8
X-MS-Tnef-Correlator:
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 64D7B4D809C for <bug-DBD-Oracle [...] rt.cpan.org>; Tue, 12 Dec 2006 19:44:20 -0500 (EST)
Received: (qmail 14574 invoked by alias); 13 Dec 2006 00:44:19 -0000
Received: from smtp4.clear.net.nz (HELO smtp4.clear.net.nz) (203.97.37.64) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Tue, 12 Dec 2006 16:44:17 -0800
Received: from wlgscm01.telstraclear.co.nz (wlgscm01.clear.co.nz [10.201.12.85]) by smtp4.clear.net.nz (CLEAR Net Mail) with SMTP id <0JA600EXLSMIU200 [...] smtp4.clear.net.nz> for bug-DBD-Oracle [...] rt.cpan.org; Wed, 13 Dec 2006 13:42:18 +1300 (NZDT)
Received: from (unknown [10.200.12.228]) by wlgscm01.telstraclear.co.nz with smtp id 4122_c9152aac_8a42_11db_8ca8_001143d1ccca; Wed, 13 Dec 2006 13:42:18 +1300
Received: from TDSEXC01.telstraclear.tclad ([10.201.12.96]) by takexcowa01.telstraclear.tclad with Microsoft SMTPSVC(6.0.3790.1830); Wed, 13 Dec 2006 13:42:18 +1300
Delivered-To: cpan-bug+dbd-oracle [...] diesel.bestpractical.com
Subject: RE: [rt.cpan.org #18926] DBI failed to catch DBD::Oracle exception
Return-Path: <Herman.KALL [...] team.telstraclear.co.nz>
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: bug-DBD-Oracle [...] rt.cpan.org
Thread-Index: Accd8U2wMu+gXo8ESc6Qlrcc3T9AFwAXdGnA
Date: Wed, 13 Dec 2006 13:42:17 +1300
Thread-Topic: [rt.cpan.org #18926] DBI failed to catch DBD::Oracle exception
X-MS-Has-Attach:
Message-Id: <9C3D26A899CEEA459F3455F8B29607935D06F9 [...] TDSEXC01.telstraclear.tclad>
X-Mimeole: Produced By Microsoft Exchange V6.5
To: bug-DBD-Oracle [...] rt.cpan.org
Content-Transfer-Encoding: base64
From: Herman KALL <Herman.KALL [...] team.telstraclear.co.nz>
X-RT-Original-Encoding: utf-8
RT-Message-ID: <rt-3.6.HEAD-27298-1165970668-1076.18926-0-0 [...] rt.cpan.org>
Content-Length: 990
Download (untitled) / with headers
text/plain 990b
Hi, thanks for that. retrieving the return value vai block eval solves the poblem i had. Cheers, Herman Show quoted text
-----Original Message----- From: via RT [mailto:bug-DBD-Oracle@rt.cpan.org] Sent: Wednesday, 13 December 2006 02:27 To: Herman KALL Subject: [rt.cpan.org #18926] DBI failed to catch DBD::Oracle exception <URL: http://rt.cpan.org/Ticket/Display.html?id=18926 > Looking at the latest version of DBD 1.19 I have traced back all the code to back to DBI and there is now bug that I can find. This might be a miss interprotaion of what RaiseError and PrintError will do If there is an SQL error and RaiseError is set to 0 then execution of the perl program will continue. If it is set to 1 it will throw a Perl error which can be trapped in an eval {}; I have tested the two scrips and the work (well don't work actually) for me as expected. Try your sripts with the same Raise and Print Error values and you will see how it works.
MIME-Version: 1.0
In-Reply-To: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-27293-1166010077-746.18926-0-0 [...] rt.cpan.org>
References: <9C3D26A899CEEA459F3455F8B29607935D0574 [...] TDSEXC01.telstraclear.tclad>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 18
Ok I will close it


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.