When we insert duplicates, we do get SQLException as a response. We are using Oracle 9.2, however.

No idea why they behave differently. What does the DB do if you insert duplicates from "sqlplus" or a similar tool?

Antonio Fiol


George Sexton wrote:

The error is signaled by getting 0 back as the number of affected
records.

-----Original Message-----
From: David Short [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 10:16 PM
To: 'Tomcat Users List'
Subject: RE: Yet another OT question.


My statement is performing an insert, which would not return a result set. An executeQuery() would return a result set. I too, read the description about returning an int. I intentionally tried inserting a duplicate value in the index, trying to force an error, and no error was generated. The return value was 0. So, it is returning zero (nothing was inserted) but that's it. No SQLException. There's got to be a way to catch an error like this.

-----Original Message-----
From: George Sexton [mailto:[EMAIL PROTECTED]
Sent: Monday, February 02, 2004 8:10 PM
To: 'Tomcat Users List'; [EMAIL PROTECTED]
Subject: RE: Yet another OT question.


I broke out my JDBC handbook (JDBC API Tutorial and Reference, Second Edition) and it says:

"Returns an int indicating the number of rows affeted by an
INSERT,UPDATE, or DELETE statement; 0 if no rows were affected or the
statement executed was a DDL statement."

"Throws SQLException if the sepcified argument is a statement that
generates a result set."

From reading this, it appears the driver is compliant and working per
the specification.

-----Original Message-----
From: David Short [mailto:[EMAIL PROTECTED]
Sent: Monday, February 02, 2004 7:59 PM
To: 'Tomcat Users List'
Subject: RE: Yet another OT question.


I pulled the latest (1.2 for Oracle 8.1.7) off of Oracle's web site today.

-----Original Message-----
From: George Sexton [mailto:[EMAIL PROTECTED]
Sent: Monday, February 02, 2004 6:33 PM
To: 'Tomcat Users List'; [EMAIL PROTECTED]
Subject: RE: Yet another OT question.


Probably a flake in the Oracle driver. Check you are using the latest one.

-----Original Message-----
From: David Short [mailto:[EMAIL PROTECTED]
Sent: Monday, February 02, 2004 4:18 PM
To: 'Tomcat Users List'
Subject: Yet another OT question.


It seems like a slow day on the list so, thought I'd throw my issue out there.

I'm working with Tomcat 4.1.0, Oracle 8.1.7 and JDBC 1.2.  It seems that
the
JDBC executeUpdate() method doesn't raise an exception when I pass an
incorrect SQL statement.  It returns 0 rows, but no exception.  Anyone
seen
this before?





Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to