Return value from Statement.executeBatch() method

The return value differs from the JDBC 3.0 specification in the following ways:
  • If the IFX_BATCHUPDATE_PER_SPEC environment variable is set to 0, only the update count of the first statement executed in the batch is returned. If the IFX_BATCHUPDATE_PER_SPEC environment variable is set to 1 (the default), the return value equals the number of rows affected by all SQL statements executed by Statement.executeBatch(). For more information, see HCL OneDB environment variables with the HCL OneDB JDBC Driver.
  • When errors occur in a batch update executed in a Statement object, no rows are affected by the statement; the statement is not executed. Calling BatchUpdateException.getUpdateCounts() returns 0 in this case.
  • When errors occur in a batch update executed in a PreparedStatement object, rows that were successfully inserted or updated on the database server do not revert to their pre-updated state. However, the statements are not always committed; they are still subject to the underlying autocommit mode.

The BatchUpdate.java example file shows how to send batch updates to the database server.