Batch Processing in JDBCInstead of executing a single query, we can execute a batch (group) of queries. It makes the performance fast. The java.sql.Statement and java.sql.PreparedStatement interfaces provide methods for batch processing. Advantage of Batch ProcessingFast Performance Methods of Statement interfaceThe required methods for batch processing are given below:
Example of batch processing in jdbcLet's see the simple example of batch processing in jdbc. It follows following steps:
If you see the table user420, two records has been added. Example of batch processing using PreparedStatementIt will add the queries into the batch until user press n. Finally it executes the batch. Thus all the added queries will be fired. Next TopicJDBC RowSet
|