3,494
社区成员




StringBuffer sql = new StringBuffer();
sql.append("insert into ex_log (id,prov,city,customermanager,backuptel,worktime,gooffwordtime,telphoneC,vipuname" +
",viplevel,vipnum,telphoneV) values (ex_log_seq.nextval,?,?,?,?,?,?,?,?,?,?,?)");
Long startTime = System.currentTimeMillis();
PreparedStatement pst = (PreparedStatement) conn.prepareStatement(sql.toString());
//每5w提交一次
for (int i = 1; i <= xssfSheet.getLastRowNum(); i++) {
Map cell = excelUtils.readExcel2MapRowByRow(i, xssfSheet);
if (cell == null || cell.isEmpty()){
//这里有空项,后面需要打印到文件
return null;
}
pst.addBatch();
}
// 执行批量更新
pst.executeBatch();
// 语句执行完毕,提交本事务
conn.commit();
Long endTime = System.currentTimeMillis();
System.out.println("用时:" + (endTime - startTime)+"毫秒!");
pst.close();
conn.close();
感谢大家的热心帮助!