1 //事务管理 2 public void executeTran(String[] sql){ 3 Connection connection = getConnection(); 4 PreparedStatement pstmt睿共享 = null; 5 6 try { 7 //开启自动提交 8 connection.setAutoCommit(false); 9 //预编译睿共享 sql睿共享 10 for (int i = 0; i) 睿共享 { 11 pstmt= connection.prepareStatement(sql[i]); 12 pstmt.executeUpdate(); 13睿共享 } 14 } catch (SQLException e) { 15 e.printStackTrace(); 16 } 17 }