com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:当autocommit = true时无法调用回滚 [英] com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Can't call rollback when autocommit=true

查看:1073
本文介绍了com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:当autocommit = true时无法调用回滚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用Jboss5.0和mysql。并且会有很多并发操作,而DB包含相当多的记录。
此错误频繁发生..时不时。

Im using Jboss5.0 with mysql in my application. and there will be lot of concurrent actions and DB contains considerably lot of records. this error is coming frequently.. every now and then.

 com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:
 Can't call rollback when
 autocommit=true    at
 com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888)
    at
 com.mysql.jdbc.Connection.rollback(Connection.java:5192)
    at
 org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.rollback(LocalManagedConnection.java:97)
    at
 org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.tidyup(TxConnectionManager.java:783)
    at
 org.jboss.resource.connectionmanager.BaseConnectionManager2.returnManagedConnection(BaseConnectionManager2.java:453)
    at
 org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:734)
    at
 org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:362)
    at
 org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:155)

任何人都可以帮忙吗?

提前致谢

推荐答案

要么在打开自动提交时尝试调用回滚,要么在数据库中使用不支持事务的MyISAM类型表(以及回滚功能)。

Either you are attempting to call rollback when auto commit is turned on, or you're using MyISAM type tables in your database which do not support transactions (and the ability to rollback).

根据堆栈跟踪判断,数据库的事务失败,并且在尝试创建SQLException并回滚事务时,会发生此异常。除非有更多的异常(比如指示你的代码中的异常被触发的地方),否则我会猜测它是由MyISAM表引起的。

Judging by the stacktrace, a transaction to the database is failing and in an attempt to create an SQLException and rollback the transaction, this exception is occurring. Unless there's more to the exception (like an indication as to where in your code the exception is being fired), then I would hazard a guess that it's due to MyISAM tables.

这篇关于com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:当autocommit = true时无法调用回滚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆