public void addDeptList(List<Dept> paramList) throws Exception{
Connection conn = DBUtil.getConn();
PreparedStatement ps= conn.prepareStatement("insert into dept values(?,?,?)");
for(Dept d:paramList){
ps.setInt(1, d.getDeptno());
ps.setString(2, d.getDname());
ps.setString(3, d.getLoc());
ps.addBatch();
}
ps.executeBatch();
DBUtil.close(conn, ps);
}
转载于:https://www.cnblogs.com/hwgok/p/5932202.html