O'Reilly logo

Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ by Dan Scott, George Baklarz, Paul C. Zikopoulos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Batching Requests

Issuing multiple INSERT or UPDATE statements against a database can be very inefficient, especially if the client is on a remote network. Each time the executeUpdate() method is called, the SQL is sent to the database engine and is processed, and then results are returned to the application. This process is repeated until all of the rows are inserted, deleted, or updated.

JDBC includes the addBatch(), clearBatch(), and executeBatch() methods to improve the efficiency of sending multiple SQL requests to the database engine. These batch methods are summarized in the following list.

  • void addBatch(String sql)— This method allows a programmer to batch a number of statements together in one call to the database. To reduce the overhead ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required