-1
我使用jdbc批處理語句在數據庫表中插入132,000條記錄。我面臨的問題是所有記錄都沒有插入到表中,只插入記錄1444。在jdbc批處理中處理100,000條記錄更新
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);
}
任何人都可以幫我嗎?
你沒有提供足夠的信息,例如它是否會產生錯誤? – Matt 2011-02-02 10:32:09