private void insert(List<Mobile_list> list) { if (list == null || list.size() < 1) { return; } //取得连接 Connection conn = DBconn.get55Conn(); String sql = "insert into mobile_list(num,area,t) values(?,?,?)"; PreparedStatement ps = null; try { ps = conn.prepareStatement(sql); for (Mobile_list mobile : list) { ps.setString(1, mobile.getNum()); ps.setString(2, mobile.getArea()); ps.setString(3, mobile.getType()); ps.addBatch();//添加批处理 } ps.executeBatch();//执行批处理 System.out.println("成功插入数据"); } catch (SQLException e) { e.printStackTrace(); }finally{ //释放资源 Common.release(conn, ps, null); } }