General discussion


How to handle JDBC BatchUpdateException

By dmitry ·
Please help -

I use batch insert for inserting records into the database. Sometimes, when calling statement.executeBatch(), the database throws BatchUpdateException due to a unique constraint. I need to find out which record violated the constraint and reject it. I have tried calling ex.getUpdateCounts(), but all elements in the array have the same value (-3). Is it how the driver supposed to work? Is there another way to figure out which record(s) in the batch violated the unique constraint?

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Comments

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums