db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Batch exceptions
Date Fri, 10 Jun 2005 05:40:19 GMT
I've been adding the batch execution tests for setting values to
parameterMapping.java. When running with the network client I see this
exception on a conversion error (e.g. setTimestamp() on a SMALLINT column).

(?????):Non-atomic batch failure.  The batch was submitted, but at least
one exception occurred on an individual member of the batch. Use
getNextException() to retrieve the exceptions for specific batched elements.
(XCL12):Error for batch element #0: An attempt was made to put a data
value of type 'java.sql.Timestamp' into a data value of type 'SMALLINT'.


I think the message is confusing and could be cleaned up, what is a
non-atomic batch failure, the client has no mention of an atomic batch
failure? Why not just batch failure. But is such a message needed?

Embedded takes a simpler approach of creating a BatchUpdateException
with the SQLState, message and errorCode directly from the SQLException
that was thrown. Thus no wrapper message that just says 'see next
exception'.

However, embedded doesn't try to indicate which batch command caused
which batch exception, which the client does. See the 'Error for batch
element[0]' in the message above. I'm not sure what value this is, it's
not a programtic api, such an api would be non-standard, and I'm not
sure we would recommend applications parsing error messages to figure
out which exception went with which batch element.

For the parameterMapping test I'll commit with the current output for
the net client, but it may be an difference to resolve in the future.

I think the simpler embedded approach is the way to go.

Dan.


Mime
View raw message