Mysql不支持JDBC的autoCommit事务操作吗?

发布于 2022-09-06 05:44:39 字数 1347 浏览 24 评论 0

下面是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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深巷少女 2022-09-13 05:44:39

你的Mysql表类型是 innodb 还时 myisam 后者是不支持事务的

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文