【发布时间】:2011-02-02 09:49:17
【问题描述】:
我正在使用 jdbc 批处理准备语句在数据库表中插入 132,000 条记录。我面临的问题是所有记录都没有插入到表中,只插入了 1444 条记录。
try{
StringBuffer insert = new StringBuffer("INSERT INTO mytable (field1,field2,
,field3,field 4 ) VALUES ( ?, ?, ?, ? )");
pstmt = conn.prepareStatement(insert.toString());
Iterator cptIcd9Iterator = cptIcd9List.iterator();
while(cptIcd9Iterator.hasNext()){
cptIcd9VO = (CptIcd9VO)cptIcd9Iterator.next();
count++;
pstmt.setString(1, "field1");
pstmt.setString(2, "field2");
pstmt.setString(3, "field3");
pstmt.setInt(4, 4);
pstmt.addBatch();
}
updateCounts = pstmt.executeBatch();
}
catch (Exception e) {
logger.error(e);
}
谁能帮帮我?
【问题讨论】:
-
你没有提供足够的信息,例如它会产生错误吗?
-
不,它不会给出任何错误。它正常退出,没有任何异常或错误
-
updateCounts 最后是什么?这个标志是否只对 1444 行成功?