I am inserting 132,000 records in a database table using jdbc batch of prepated statement. The problem i am facing is all records are not inserted in to table only records 1444 are inserted.
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);
}
Can anyone help me ?