2011年11月10日

Statement和PreparedStatement批量更新

摘要: 1)addBatch()将一组参数添加到PreparedStatement对象内部。2)executeBatch()将一批参数提交给数据库来执行,如果全部命令执行成功,则返回更新计数组成的数组。Statement:1)addBatch(Stringsql)方法会在批处理缓存中加入一条sql语句。2)executeBatch()执行批处理缓存中的所有sql语句。注意:PreparedStatement中使用批量更新时,要先设置好参数后再使用addBatch()方法加入缓存。批量更新中只能使用更改、删除或插入语句。Statement批量处理和事务代码如下: package com.ambow.da 阅读全文

posted @ 2011-11-10 08:57 linzuxin 阅读(248) 评论(0) 推荐(0) 编辑

导航