com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Can't call rollback when autocommit=true

13,276

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).

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.

Share:
13,276
Tamizh
Author by

Tamizh

Developer

Updated on July 23, 2022

Comments

  • Tamizh
    Tamizh almost 2 years

    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)
    

    can anyone help?

    Thanks in advance

  • Tamizh
    Tamizh over 13 years
    im using innodb and it support transactions. im having both transactional and non-transactional queries.
  • Cyntech
    Cyntech over 13 years
    @Tamizh, are you calling rollback() in your code and if so, have you tried disabling auto commit before doing so?
  • Tamizh
    Tamizh over 13 years
    yes whenever i use transactions i first set autocommit false. and now i found its coming as WARN in jboss log file instead ERROR. so actually this is a WARNING when connections lost or blinking for long time i guess