I am writing Java code for inserting 45000 records into the table and I\'m using the following code:
//create Db Connection
List sqlInsertQueries =
You should make sure that auto commit is false, and use prepared statements. Prepared statements can be used for insert and update.
connection con.setAutoCommit(false);
PreparedStatement prepStmt = con.prepareStatement("INSERT INTO table (val1,val2) VALUES (?,?)");
for all values:
prepStmt.setString(1,val1);
prepStmt.setString(2,val2);
prepStmt.addBatch();
stmt.executeBatch();
conn.commit();