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:
1. JDBC batch processing using Statement example.
2. JDBC batch processing using PrepareStatement example.
3. JDBC batch processing using CallableStatement example.
Next Topic: JDBC store file example.
Previous Topic: JDBC CallableStatement Stored procedure batch update example.