日期:2014-05-16 浏览次数:20594 次
public boolean execInsertTables(String[] sqls) { boolean flag = false; con = dbc.getConnection(); try { con.setAutoCommit(false); int a = 0; for (int i = 0; i < sqls.length; i++) { pst = con.prepareStatement(sqls[i]); pst.addBatch(); if(i<sqls.length-1){ pst.close(); } a = i; } System.out.println(a+" ** "+sqls.length); pst.executeBatch(); con.commit(); flag = true; } catch (Exception e) { flag = false; Tasklogger.debug("插入数据失败 TaskDao 里的 execInsertTables!" + e); e.printStackTrace(); } finally { dbc.closeExe(pst, con); } return flag; }