* Batch processing is the process of executing multiple SQL statements in one transaction. For example, consider the case of loading data from CSV(Comma-Separated Values) files to relational database tables. Instead of using Statement or PreparedStatement, we can use Batch processing which executes the bulk of queries in a single go for a database.
* Advantages of Batch processing :
* It will reduce the communication time and improves performance.
* Batch processing makes it easier to process a huge amount of data and consistency of data is also maintained.
* It is much faster than executing a single statement at a time because of the fewer number of database calls.
* How to perform Batch processing?
To perform Batch processing, addBatch()
and executeBatch()
methods are used. These 2 methods are available in the Statement and PreparedStatement classes of JDBC API.