一个简单的问题,我似乎无法找到答案而且不会重新配置数据库以记录查询....
问题是:驱动程序是否自动将所有SQL查询/更新包装到
中 START TRANSACTION; MyQuery; COMMIT;
?
或者有没有办法配置它来执行上述操作?
感谢。
答案 0 :(得分:1)
请参阅Connection.setAutoCommit(boolean autoCommit)
这是JDK文档中的描述。
Sets this connection's auto-commit mode to the given state. If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions.Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either the method commit or the method rollback. By default, new connections are in auto-commit mode.
答案 1 :(得分:1)