4 Replies Latest reply on Sep 26, 2002 10:32 AM by davidjencks

    autocommit/rollback/commit in oracle-service.xml

    deegs_ca

      Hi, I think this issue may have been beaten to death but here goes.

      I'm using Jboss3.0.0rc3 with oracle-service.xml picked up from the examples.

      I would like to use my java.sql.Connection in the same manner I was able to before i.e. conn.commit, conn.rollback, conn.setAutoCommit, con.getAutoCommit

      How can I get back tyo this behaviour with out it throwing an exception and stating "You cannot commit during a managed transaction!".

      I've read some of the patient explanations other people have put up. Perhaps, I've missed the most telling ones. Any links are appreciated.

      -doug

        • 1. Re: autocommit/rollback/commit in oracle-service.xml
          deegs_ca

          I'd really appreciate some feedback on this.

          All I need to do is set up a jdbc connection pool where the I have control over when to commit, when to rollback, etc.

          This was very simple in jboss2.4.x.

          As far as I can tell, due to the JCA wrapping of datasources, there is no way to do it in Jboss3.0.0RC3

          -doug

          • 2. Re: autocommit/rollback/commit in oracle-service.xml
            davidjencks

            This should work fine if you make certain there are no managed (jta transactions) started by you or jboss due to your method tx settings (such as "Required").

            Alternatively you could use the NoTxConnectionManager, then even if there are container managed transactions your db connections won't be enrolled in them.

            Alternatively you could use UserTransaction instead of commit etc directly on the connection.

            In any case, I recommend you upgrade to at least jboss 3.0.2. You won't get much support for issues on earlier versions.

            • 3. Re: autocommit/rollback/commit in oracle-service.xml
              deegs_ca

              Thanks, David.

              I went the route of NoTxConnectionManager. And that works. What is counter intuitive to me is that I want to use simple transactions and yet in order to use commit() I need to use a non-transactional connectionmanager.

              I have my own CCI JCA adapter to integrate with an EIS and would like it to support transactions.

              Essentially it wraps a jdbc connection, so in most cases
              when a client invokes
              javax.resource.cci.Connection.commit(), this cause a javax.sql.Connection.commit()

              same for rollback().

              So in this scenario, I'd like to use NoTx for the jdbc and LocalTx for my JCA. However, whenever the client invokes commit/rollback/start, I get what amounts to state violations saying I'm using the methods incorrectly something to the effect

              "Invalid attempt to begin a transaction that is already started"

              So, after looking around, it seems when one uses LocalTx, the transaction is started as soon as the container grabs a managed connection which cuts my client/consumer of my jca out of the picture.

              How is it possible to grant client the ability to commit/rollback/begin?

              • 4. Re: autocommit/rollback/commit in oracle-service.xml
                davidjencks

                don't try to mix jta tx and jdbc 1 local tx. Whenever there is a jta tx, you won't be able to use connection.commit (jdbc) or localtx.commit (cci). Personally I recommend always using jta tx for everything. I think the declarative tx support in ejb's is one of its best and most useful features and results in cleaner code design when you refactor code with explicit tx control to use declarative tx.