I am using JDBC addBatch and batchExecute for insert statements. I have autocommit mode to on. My problem is, when I have for example 20 inserts, and insert number 10 raises an exception (for example null values not allowed), no data is inserted. Shouldn't be the first 10 ok statements be inserted?.
My code:
try { int[] results = stmt.executeBatch(); return results; } catch (BatchUpdateException e) { int[] tmpres = e.getUpdateCounts(); for (i = 0; i < tmpres.length; i++) { System.out.println(tmpres[i]); } } I see on the output that the update count of the first 10 statements is 1. So why no data is inserted?
Best regards, Peter