When you have a lot of insert or update sql commands to execute, you can use java.sql.Statement addBatch(String sqlCmd) method to group them together and then run java.sql.Statement executeBatch() to commit all the commands to the database server at once.