执行完SQL后捕获异常commit() should not be called while in auto-commit mode.
解决办法:
添加 con.setAutoCommit(false);
例子如下:
con.setAutoCommit(false);
try{
execute(sql1);
execute(sql);
con.commit();
}catch(Exception e){
con.rollback();
}
执行完SQL后捕获异常commit() should not be called while in auto-commit mode.
解决办法:
添加 con.setAutoCommit(false);
例子如下:
con.setAutoCommit(false);
try{
execute(sql1);
execute(sql);
con.commit();
}catch(Exception e){
con.rollback();
}
转载于:https://www.cnblogs.com/wh-king/archive/2012/12/24/2831080.html