Friday, February 24, 2012

JDBC Statement.executeBatch mysteriously and intermittently fails on good SQL statements

Hi Everyone,

I'm in the middle of adding support to our product for SQL 2005. It has been pretty simple except for one thing the jdbc Statement.executeBatch is mysteriously failing. I changed my error handling such that whenever part of a batch fails (EXECUTE_FAILED) the query gets re-run. Well, everytime I re-run the failed statment in a new new statement object using Statement.execute it works! Another characteristic of the failure is that no matter if the batch is running 1 or 10 updates in batch, they all fail with EXECUTE_FAILED and when re-run individually they each succeed. There is no exception thrown.

Has anyone run into this?

Netmon,

We have just fixed two Batch related bugs, the first one looks to be a similar issue to the problem you are describing. Would it be possible for you to test your scenario with our newly released June Community Tech Preview?

http://www.microsoft.com/downloads/details.aspx?familyid=f914793a-6fb4-475f-9537-b8fcb776befd&displaylang=en

For all of the issues resolved on this drop take a look at the release.txt change list that ships with the package, highlighting the batching issues here:

428197 Batch execution of prepared statements works correctly when there is more
than one item in the batch.

433394 Calling Statement.executeBatch after setting a BLOB value no longer throws
an SQLException with the message "The conversion from BLOB to BINARY is unsupported."

No comments:

Post a Comment