Mysql不支持JDBC的autoCommit事务操作吗?
下面是com.mysql.jdbc.ConnectionImpl类的setAutoCommit(boolean flag)方法的注释
最后一句,Note: MySQL does not support transactions, so this method is a
no-op.
/**
* If a connection is in auto-commit mode, than all its SQL statements will
* be executed and committed as individual transactions. Otherwise, its SQL
* statements are grouped into transactions that are terminated by either
* commit() or rollback(). By default, new connections are in auto- commit
* mode. The commit occurs when the statement completes or the next execute
* occurs, whichever comes first. In the case of statements returning a
* ResultSet, the statement completes when the last row of the ResultSet has
* been retrieved or the ResultSet has been closed. In advanced cases, a
* single statement may return multiple results as well as output parameter
* values. Here the commit occurs when all results and output param values
* have been retrieved.
* <p>
* <b>Note:</b> MySQL does not support transactions, so this method is a
* no-op.
* </p>
*
* @param autoCommitFlag -
* true enables auto-commit; false disables it
* @exception SQLException
* if a database access error occurs
*/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的Mysql表类型是 innodb 还时 myisam 后者是不支持事务的