3 Replies Latest reply on Mar 15, 2002 12:39 AM by davidjencks

    XA Transaction

    benoitm

      I have a weird problem, I am using UserTransaction in JBoss, not from EJB at this time.

      I have a working thread A which selects from table T and does several inserts in the table T, all within a user transaction. This thread can take a long time to execute since it is accessing an external system.

      While the thread A is running, my web application is accessed and requires to select from table T within its own user transaction. The query hangs until thread A commits its transaction.

      I don't set isolation level (so I assume I am using read commited), I use read-only forward-only statements to read the table T from the web request.

      What am I doing wrong, why is my user request waiting of thread T to commit the transaction.

      I am using the XADataSourceLoader configured for SAP db in JBoss 2.4.4

      Pseudo code:

      thread T
      {
      getUserTransaction().begin();
      getConnection();
      prepareStatement("select ... from T where ...");
      ...
      statement.close();
      loop {
      //slow network access
      prepareStatement("insert into T ...");
      ...
      statement.execute();
      statement.close();
      }
      getUserTransaction().commit();
      }

      request
      {
      getUserTransaction().begin();
      getConnection();
      prepareStatement("select ... from T where ...");
      // this waits until thread A commits the transaction
      ...
      getUserTransaction().commit();
      }

      Thanks for you help,

      Benoit

        • 1. Re: XA Transaction
          davidjencks

          Unless you have an XADataSource implementation for SAP DB, you are not using xa transactions, "XADataSourceLoader" notwithstanding. In any case this problem is unlikely to be related to whether or not your tx are xa.

          Have you checked the SAP DB docs to find out what they think read committed means? You might want to do a little experiment with some other dbs to see if it is a SAP DB problem.

          • 2. Re: XA Transaction
            benoitm

            I have the same problem with SQL Server, so I don't think it is SapDB... It have to do with my configration:


            org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
            MyDS
            jdbc:sapdb:mydb
            dba
            password
            10
            false

            • 3. Re: XA Transaction
              davidjencks

              I have no direct experience of ms sql server, however a friend told me recently that their idea of transaction isolation seems to involve more locking and waiting than he was used to on Oracle. I haven't used 2.4.4 for a long time but your config looks ok.