5 Replies Latest reply on Feb 4, 2011 5:45 AM by iabughosh

    JBoss autocommit problem

      Hi all. After running my web application I get exception:

      java.sql.SQLException: You cannot rollback with autocommit set!


      My oracle-ds.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <datasources>
      
       <local-tx-datasource>
       <jndi-name>jdbc/alphaCommondoor</jndi-name>
       <connection-url>jdbc:oracle:thin:@gamma.app.kv.aval:1521:alfa</connection-url>
       <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
       <user-name>user</user-name>
       <password>password</password>
       </local-tx-datasource>
      
      </datasources>


        • 1. Re: JBoss autocommit problem
          peterj

          I assume that you have read the documentation for the Oracle JDBC driver on how to turn autocommit off. What does it say?

          • 2. JBoss autocommit problem
            vykalra

            All,

             

            Sorry for reviving this old thread but I am getting exactly same issue

             

            " java.sql.SQLException: You cannot rollback with autocommit set!"

             

            I tried to <no-tx-datasource> instead of <local-tx-datasource> in the -ds.xml file , I am deploying this on jboss 4.3.0.GA. My application uses hibernate and in one of the HibernateSessionWrapperclass I have the following code

             

            if (this.session.connection().getAutoCommit()) {

                                                              this.session.connection().setAutoCommit(false);

                                                    }

             

            I tried commenting this too without success. Please help !!! m clueless here...

            • 3. JBoss autocommit problem
              iabughosh

              Hi Vishal,

               

              try adding this line to your hibernate.cfg :

              hibernate.connection.autocommit = false.

               

              hope this will help you.

              • 4. JBoss autocommit problem
                vykalra

                I tried this w/o success , i get the same error :

                • 5. JBoss autocommit problem
                  iabughosh

                  Dear Vashal,

                  make sure that you are using local-tx or xa datasource and try adding this property to your hibernate.cfg:

                  hibernate.transaction.factory_class=org.hibernate.transaction.JBossTransactionManagerLookup