jdbc-batch processing

the addBatch() method is basically nothing more than a tool fro assigning a bunch of sql statements to a jdbc statement object for execution together

PreparedStatement stmt=conn.prepareStatement(
      "update account set balance=? where acct_id=?");
int[] rows;
for(int i=0;i<accts.length;i++){
    stmt.setInt(1,i);
    stmt.setLong(2,i);
    stmt.addBatch();
  }
rows=stemt.executeBatch();

posted on 2006-10-11 14:40 康文 阅读(194) 评论(0)  编辑  收藏 所属分类: java


只有注册用户登录后才能发表评论。


网站导航:
 
<2006年10月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

导航

统计

常用链接

留言簿(1)

随笔分类

随笔档案

文章档案

搜索

最新评论

阅读排行榜

评论排行榜