更新时间:2022-12-10 23:32:41
您可以禁用自动提交,执行两个单独的语句,然后手动提交事务:
You can disable autocommit, execute two separate statements and then commit a transaction manually:
connection.setAutoCommit(false);
try {
...
stmt1.execute();
...
stmt2.execute();
connection.commit();
} catch (Exception ex) {
connection.rollback();
}