Optimized Batching in jConnect

jConnect for JDBC 7.07 implements an internal algorithm to speed up batch operations for PreparedStatement objects.

This algorithm is invoked when the HOMOGENEOUS_BATCH connection property is set to true.

Note: Homogeneous batching is available only when your client application is connected to a server that supports this feature. Adaptive Server Enterprise 15.7 introduces support for homogeneous batching.

This example illustrates a PreparedStatement batching operation using the addBatch and executeBatch methods:

String sql = "update members set lastname = ? where member_id = ?";
prep_stmt = connection.prepareStatement(sql);
prep_stmt.setString(1, "Forrester");
prep_stmt.setLong(2, 45129);
prep_stmt.addBatch();
prep_stmt.setString(1, "Robinson");
prep_stmt.setLong(2, 45130);
prep_stmt.addBatch();
prep_stmt.setString(1, "Servo");
prep_stmt.setLong(2, 45131);
prep_stmt.addBatch();
prep_stmt.executeBatch();

where connection is a connection instance, prep_stmt is a prepared statement instance, and ? denotes parameter placeholders for the prepared statement.