jdbc addbatch

Statememt
PreparedStatement 都有addBatch方法

Statememt  stmt=conn.createStatement();
stmt.addBatch("insert inti .....");
stmt.addBatch("insert inti .....");
stmt.addBatch("insert inti .....");
stmt.executeBatch();
stmt.close();

PreparedStatement  ps=conn.prepareStatement("insert Into biao values(?,?)");
ps.setInt(1,61);
ps.setInt(2,61);
ps.addBatch()
ps.setInt(1,61);
ps.setInt(2,61);
ps.addBatch()

ps.executeBatch();
ps.close();

你可能感兴趣的:(jdbc)