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);
}
时间: 2024-10-26 23:30:13