View RSS Feed


Java Database Connectivity (JDBC) examples. SQL with Java.

  1. Batch Updates and Transactions

    by , 04-27-2012 at 08:18 PM
    It is important to keep in mind, that each update added to a Statement or PreparedStatement is executed separately by the database. That means, that some of them may succeed before one of them fails. All the statements that have succeeded are now applied to the database, but the rest of the updates may not be. This can result in an inconsistent data in the database.

    To avoid this, you can execute the batch update inside a transaction. When executed inside a transaction you can make ...