我使用jdbc批量的prepated语句在数据库表中插入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);
}
任何人都可以帮助我吗?