JDBC batch processing

The JDBC batch processing provides the facility to execute a group of related queries. A group of related queries is known as a batch. It reduces the amount of communication overhead and hence improves the performance.

JDBC batch processing methods:

1. addBatch(String query): It is used to add the statement to the batch.
Syntax: public void void addBatch(String query) throws SQLException
2. executeBatch(): It is used to execute batch.
Syntax: public int[] executeBatch() throws SQLException
3. clearBatch(): It is used to remove all statements from the batch.
Syntax: public void clearBatch() throws SQLException

JDBC batch processing examples:

No comments: