This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes PreparedStatement in batched mode gives Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "PreparedStatement in batched mode gives Exception" Watch "PreparedStatement in batched mode gives Exception" New topic
Author

PreparedStatement in batched mode gives Exception

Niki Nono
Ranch Hand

Joined: Mar 20, 2005
Posts: 256
Hi

I have a problem.
I am running PreparedStatement in batched mode, actually I am using Springs BatchSQLUpdate component.

Now i am creating a batch of about 10000 inserts / updates. However if any single of these inserts / updates fails, it gives exception with DataIntegrityViolation, BadSQLGrammer etc.

I am also maintaining a parallel cache of the values that I am using to bind the preparedstatements.
So for statement 1 in the batch, i know what values are being used.

My question is when the batch update fails, how can we identify which SQL statement, i mean which index in the batch caused the issue?

Please help me as I am stuck and need to build some robust exception handling for PreparedStatement batch loads.

Niki


Life called,so here I am.<br />Cheers<br />Niki.:-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PreparedStatement in batched mode gives Exception