Meaningless Drivel is fun!
The moose likes JDBC and Relational Databases and the fly likes Batch updates using PreparedStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Batch updates using PreparedStatement " Watch "Batch updates using PreparedStatement " New topic

Batch updates using PreparedStatement

Alok Pota
Ranch Hand

Joined: Mar 07, 2001
Posts: 185
I have an insert statement that inserts a BLOB into the table, and this statement is executed in a loop for about 100 times. I would like to be able to batch the individual
statements. Can it be done?
Will it be faster than issuing 100 different statements to the connection.
karim qazi

Joined: Mar 22, 2001
Posts: 20
you can try something like this...
Statement statement = connection.createStatement();
//whatever you are looping through
String sqlString = "Insert into table (name)values
('" + name + "')";
I agree. Here's the link:
subject: Batch updates using PreparedStatement
It's not a secret anymore!