6 Replies Latest reply on Feb 9, 2003 12:04 PM by J.D. Corbin

    How to set autocommit in JBOSS3.0.4 for Informix?

    J.D. Corbin Newbie

      I would like to set the autocommit feature of my Informix JDBC driver to default to false. I am using JBOSS3.0.4. Any help would be greatly appreciated.

      Thanks,

        • 1. Please Help!!!!!!!!
          J.D. Corbin Newbie

          I get the following error in JBOSS 3.0.4 (never saw in JBOSS 2.4.x) and haven't been able to make any headway towards resolving it.

          I've read about the error and understand it but do not know how to configure the informix-service so it doesn't happen. I have tried both the non-xa and xa drivers with no success.

          Pllllllllllllllllllleaaaaaaaase advise.

          [STDERR] java.sql.SQLException: You cannot set autocommit during a managed transaction!
          [STDERR] at org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.setJdbcAutoCommit(LocalManagedConnection.java:447)
          [STDERR] at org.jboss.resource.adapter.jdbc.local.LocalConnection.setAutoCommit(LocalConnection.java:426)
          [STDERR] at com.lightspeed.util.db.DBUtil.getConnection(DBUtil.java:87)
          [STDERR] at com.lightspeed.util.db.DBUtil.query(DBUtil.java:285)
          [STDERR] at com.lightspeed.dao.resreg.validation.ResValidationSingleton.isCashSettlementType(ResValidationSingleton.java:2820)
          [STDERR] at com.lightspeed.dao.reservation.ReservationCreateBean.sanityCheck(ReservationCreateBean.java:480)
          [STDERR] at com.lightspeed.dao.reservation.ReservationCreateBean.createReservation(ReservationCreateBean.java:268)
          [STDERR] at com.lightspeed.dao.reservation.ReservationCreateBean.createReservation(ReservationCreateBean.java:210)
          [STDERR] at java.lang.reflect.Method.invoke(Native Method)
          [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
          [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
          [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
          [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
          [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
          [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)

          • 2. Re: How to set autocommit in JBOSS3.0.4 for Informix?
            J.D. Corbin Newbie

            Okay, does anyone know anything about this????

            When I am in a local transaction I get a JBOSS error that says I am not allowed to set autocommit during a manage transaction.

            Can someone PLEASE at least explain to me what the heck is going on in JBOSS 3.0.x that is so different from JBOSS 2.4.4 (no problems)?

            It is tough getting any kind of a response from this board.

            Esconion

            • 3. Re: How to set autocommit in JBOSS3.0.4 for Informix?
              Radu Mateescu Newbie

              since you use JBoss-registered datasource to create your connection, you have a "managed connection" scenario. I assume the JBoss connection manager intercepts your getConnection() call and a ManagedConnection will actually return the high-level connection you're using further. The transaction boundaries will be set by your transactional context (be it bean-managed where you use a UserTransaction object or container-managed where you have to set a transactional attribute) rather then your autocommit() statement.

              • 4. Re: How to set autocommit in JBOSS3.0.4 for Informix?
                J.D. Corbin Newbie

                And that was my understanding as well. The problem is, I have as yet been unable to find out where in the informix-service.xml to set the attribute. I assume the attribute name would be autocommit with a value of false.

                Thanks for the reply.

                • 5. Re: How to set autocommit in JBOSS3.0.4 for Informix?
                  David Jencks Master

                  don't try to set autocommit if you are using CMT or UserTransaction. There's a minor bug in the jca jdbc wrappers that make it report that autocommit is true inside managed transactions: I didn't read what the spec says it should return. Nevertheless, all work you try to do in a managed (JTA) transaction is really in that transaction and is not autocommitted.

                  Only call setAutocommit(false) if you are using BMT and for some reason you aren't willing to use UserTransaction.

                  • 6. Re: How to set autocommit in JBOSS3.0.4 for Informix?
                    J.D. Corbin Newbie

                    I am not attempting to set autocommit in my application. I am wondering why the JBOSS implementation appears to be trying to do so. See exception snippet below:

                    org.jboss.resource.adapter.jdbc.local.LocalConnection.setAutoCommit(LocalConnection.java:426)

                    I guess I don't understand what is causing this call to be made within the JBOSS implementation of the LocalConnection class. I know that I do not explicitely set it anywhere in my codebase.

                    Thx.