JavaAdvanced#jdbc

What is batch processing in JDBC?

Batch processing groups multiple SQL statements together and sends them to the database in a single network round trip using addBatch() and executeBatch(), significantly improving performance for bulk inserts/updates.

Example
PreparedStatement ps = conn.prepareStatement("INSERT INTO logs(msg) VALUES(?)");
for (String msg : messages) { ps.setString(1, msg); ps.addBatch(); }
ps.executeBatch();

Related Questions

1
JavaBeginner#spring

What is Inversion of Control (IoC) in Spring?

Open
2
JavaIntermediate#spring

What are the different types of dependency injection in Spring?

Open
3
JavaBeginner#spring

What is the difference between @Component, @Service, @Repository, and @Controller?

Open