您好,欢迎访问一九零五行业门户网

PreparedStatement批处理

preparedstatement批量更新关键代码 无 import java.sql.connection;import java.sql.preparedstatement; //...string sql = insert into employee (name, city, phone) values (?, ?, ?);connection connection = new getconnection();preparedstatement p
preparedstatement批量更新关键代码 import java.sql.connection;import java.sql.preparedstatement; //...string sql = insert into employee (name, city, phone) values (?, ?, ?);connection connection = new getconnection();preparedstatement ps = connection.preparestatement(sql); for (employee employee: employees) { ps.setstring(1, employee.getname()); ps.setstring(2, employee.getcity()); ps.setstring(3, employee.getphone()); ps.addbatch();}ps.executebatch();ps.close();connection.close();
其它类似信息

推荐信息