[red]JDBC 2.0[/red]
// turn off autocommit
con.setAutoCommit(false);
Statement stmt = con.createStatement();
stmt.addBatch("INSERT INTO employees VALUES (1000, 'Joe Jones')");
stmt.addBatch("INSERT INTO departments VALUES (260, 'Shoe')");
stmt.addBatch("INSERT INTO emp_dept VALUES (1000, 260)");
// submit a batch of update commands for execution
int[] updateCounts = stmt.executeBatch();
===========================================================================
1. If the value of an array entry is greater than or equal to zero, then
the batch
element was processed successfully and the value is an update count indicating
the number of rows in the database that were effected by the element’s
execution.
2. A value of -2 indicates that a element was processed successfully, but that the
number of effected rows is unknown.
===========================================================================
PreparedStatements
// turn off autocommit
con.setAutoCommit(false);
PreparedStatement stmt = con.prepareStatement(
"INSERT INTO employees VALUES (?, ?)");
stmt.setInt(1, 2000);
stmt.setString(2, "Kelly Kaufmann");
stmt.addBatch();
stmt.setInt(1, 3000);
stmt.setString(2, "Bill Barnes");
stmt.addBatch();
// submit the batch for execution
int[] updateCounts = stmt.executeBatch();
=============================================================================
Maybe, it can help u.