2 Replies Latest reply on Nov 5, 2003 8:36 AM by mlipp

    EJB DB access, JMS and Transactions


      I have an EJB doing something in the database and writing a message to a JMS queue (using jdbc persistence in the same database) in one transaction. Do I need an RDBMS with distributed transaction support for this?

      A container could find out that the queue access should use the same db connection (it does so when different EJBs access the DB in one transaction) , but I have the impression that JMS uses its own connection, so we have one DB user for EJBs accessing the DB and another DB user for accessing the queue tables. Am I right?

      - Michael

        • 1. Re: EJB DB access, JMS and Transactions
          Adrian Brock Master

          Another frequently asked question.
          Is the search function really so hard to find.

          I will repeat the answer (but this is the only time this month).

          JBossMQ's use of the db is irrelvent, it does so in a different

          If you have multiple resources in a transaction (JMS and EJB)
          you don't need an XA datasource,
          BUT if the commit fails you will get inconsistent results.

          Two phase commit
          JMS -> prepare (ok)
          EJB -> DB prepare (Not XA - no support for prepare)
          JMS -> commit (ok)
          EJB -> commit (only supports one phase, if it fails - VERY BAD)


          • 2. Re: EJB DB access, JMS and Transactions

            Thank you. BTW, I did search the forum - maybe using the wrong keywords.

            - Michael