9 Replies Latest reply on Jun 22, 2003 9:55 PM by xiaoyi

    how to let jca to connect two resources?

    xiaoyi

      Hi!
      I want to use jboss server1 and jboss server2 to complish a distributed transaction.
      I want to use jca to connect to database which is in the jboss server1 and ejb which is in the jboss server2.
      I want to know whether the jca support it.
      that is the jca adapter connect two resource---database and ejb .and the resource is not in the same JVM.
      and they finish a transaction based xa.
      Could it complish?
      And how to deal with?how to let the jca to connect two resource and finish a distributed transaction?
      thanks!

        • 1. Re: how to let jca to connect two resources?

          JBoss does not include a DTM, unless you use
          jboss4 where there is an untested implementation.

          The idea of a distributed transaction is the
          transactional context is propagated between
          servers and XAResources associated with
          it. At commit each XAResource's work is prepared then
          committed.

          JCA or DTMs do not solve your problem.
          Typically server1 and server2 will get different
          XAResources.

          Regards,
          Adrian

          • 2. Re: how to let jca to connect two resources?
            xiaoyi

            Hi,warjort,thanks your reply!
            my jboss version is 4.0 alpha.and i have tested to deal with a very simple distributed transaction between two jboss servers.
            And I also test the adapter for propertiedfile that is an example adapter.
            And now i want to know how to create a jca adapter to connect an ejb which is a cmp on another jboss server.
            my means is how to let the jca adapter that calling another ejb is involed in the distributed transaction.
            thanks!

            • 3. Re: how to let jca to connect two resources?

              I haven't looked at the jboss4 DTM.

              If it is working correctly, you should be able to
              use a datasource on one jboss server, then
              invoke an ejb on a different server and
              finally commit the transaction on the original server.
              Both transactions should either commit or rollback
              together.

              To make this work you will need a db with a
              XA support.

              Regards,
              Adrian

              • 4. Re: how to let jca to connect two resources?

                That should be both XAResources, there is
                only one transaction with multiple branches.

                Regards,
                Adrian

                • 5. Re: how to let jca to connect two resources?
                  xiaoyi

                  oh,yes!
                  my dbs are oracle and db2.both of them are XAResource.
                  I want to know how to create jca that call cmp ejb which is on the jboss2.
                  Must i create xatransaction interface in jca adapter?
                  or only complish the connection not transaction support in the adatper?
                  Regards
                  li.xt

                  • 6. Re: how to let jca to connect two resources?

                    You should just invoke the ejb.
                    If it has tranacton "Required" the ejb on server2
                    should run in the same transaction as the one
                    started on server1.
                    The transactional context should be propagated
                    automatically.

                    Regards,
                    Adrian

                    • 7. Re: how to let jca to connect two resources?
                      lawrencewong

                      Also ensure that you specify the two phase commit (2PC) protocol datasource classes instead of the usual one phase commit (1PC) protocol classes.

                      For DB2,
                      specify
                      COM.ibm.db2.jdbc.DB2XADataSource
                      instead of
                      COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource

                      For Oracle,
                      specify
                      oracle.jdbc.xa.client.OracleXADataSource
                      instead of
                      oracle.jdbc.pool.OracleConnectionPoolDataSource

                      Otherwise, you will get a Transaction rollback. I have not done this on JBoss, but with WebSphere you will get a msg "Illegal use of 1PC resouce" etc. if you do not specify the correct 2PC classes.

                      • 8. Re: how to let jca to connect two resources?
                        xiaoyi

                        oh!
                        but how to create a jca adapter that connect to an ejb that is in another jboss server?
                        Regards
                        li.xt

                        • 9. Re: how to let jca to connect two resources?
                          xiaoyi

                          oh!thanks!
                          but how to create a jca adapter that connect to an ejb that is in another jboss server?
                          Regards
                          li.xt