2 Replies Latest reply on Sep 4, 2007 9:54 AM by vmdocua

    UserTransaction & automatic resources enlistment

    vmdocua

      Hello All,

      It's going to be very easy to make with JBoss AS, but unfortunately I am not able to figure out how:

      We need to configure JBoss 4.2.1.GA (Arjuna 4.3.2.SP5?) web application to work with transactions in similar to JOTM way, with automatic DB resources enlistment/de-listment and UserTransaction-based demarcation mechanism. E.g.:

      1) UserTransaction is retrieved via JNDI "java:comp/UserTransaction" lookup.
      2) Transaction started by UserTransaction.begin() call.
      3) Some client code retrieves DB connection on the same thread, e.g. via JNDI "java:db_pool" lookup.
      4) Retrieved "java:db_pool" connection should be automatically enlisted in current transaction.
      5) Client closes "java:db_pool" connection.
      6) Transaction is committed or rolled back by UserTransaction.commit() | UserTransaction.rollback() APIs.

      Actually I created test case for steps described above, configured JBoss 4.2.1.GA DB "java:db_pool" connection as <local-tx-datasource> datasource but according to test results, "java:db_pool" connection is not enlisted in current transaction. Are there any samples demonstrating similar technique we need?

      --
      Thanks in advance,
      Vadim.

        • 1. Re: UserTransaction & automatic resources enlistment
          jhalliday

          Sounds like you need xa-tx-datasource rather than local-tx-datasource

          • 2. Re: UserTransaction & automatic resources enlistment
            vmdocua

            Thanks for suggestion. Resolved problem. Actually it is bug in MySQL driver or DB problem (MySQL 5.0.45, MySQL connector 5.0.7, JDK 1.5.0_12, JBoss AS 4.2.1.GA). <xa-datasource> is also doesn't work for MySQL, played with different variations like <track-connection-by-tx/>, <no-tx-separate-pools/>, <new-connection-sql>set autocommit=1</new-connection-sql> etc.

            After switching to normal DB2 DB and drivers my original test case with <local-tx-datasource/> start working.

            Vadim.