File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Batch updates of preparedstatement

 
Alok Pota
Ranch Hand
Posts: 185
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we use batch updates with PreparedStatements.. ? more specifically how do I bind variables t a bunch of preparedstatements added to a batch
is it something like this:-
Statement stmt = conn.createStatement();
stmt.addBatch("update test set id = ? where id = ?");
stmt.addBatch("delete from test1 where id = ?");
stmt.addBatch("insert into test values(?,?,?)");
stmt.setString(1,"hjghj");
stmt.setInt(2,55);
stmt.setString(3,"ghj");
stmt.setString(4,"hjghj");
stmt.setInt(5,55);
stmt.setString(6,"ghj");
stmt.executeBatch();
Would the above work?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic