Thread: compare speed
View Single Post
  #1 (permalink)  
Old 06-28-2007, 05:43 AM
bbq bbq is offline
Senior Member
 
Join Date: Jun 2007
Posts: 134
bbq is on a distinguished road
compare speed
I want to choose the fastest:

Code:
1. PreparedStatement stmt = con.prepareStatement( "INSERT INTO pupils VALUES (?, ?)"); stmt.setInt(1, 1000); stmt.setString(2, "Edward Brown"); stmt.addBatch(); stmt.setInt(1, 3000); stmt.setString(2, "Beto Fri"); stmt.addBatch(); // submit the batch for execution int[] updateCounts = stmt.executeBatch();
2.
Code:
PreparedStatement stmt = con.prepareStatement( "INSERT INTO pupils VALUES (?, ?)"); stmt.setInt(1, 1000); stmt.setString(2, "Edward Brown"); stmt.executeUpdate(); stmt.setInt(1, 3000); stmt.setString(2, "Beto Fri"); stmt.executeUpdate();
which one is fast for execution and why?
Reply With Quote
Sponsored Links