5 Replies Latest reply on Nov 1, 2002 4:14 PM by imdkidd

    Question about XADatasource connection pool

    lj123w

      Hi,
      I've been reading through all connection pool related topics, however, I found no conclusive answers. Hope someone can help me clarify some concepts about connection pool questions. I'm using Oracle 8.1.7 and JBoss 3.0. Currently, I was able to configure XADatasource to Oracle database and able to get resultset back for manipulation with the following codes:

      ...
      try{
      InitialContext ic = new InitialContext();
      DataSource ds = (DataSource)ic.lookup("java:/XAOracleDS");
      Connection conn = ds.getConnection();
      ...do somthing with the connection
      conn.close();
      } catch(Exception e){
      System.out.println(e.getMessage());
      e.printStackTrace();
      }

      However, if I tried to get another connection before the first connection closed, I got exception raised as follows:

      11:21:59,163 WARN [TxCapsule] XAException: tx=XidImpl [FormatId=257, GlobalId=54111-IRM//72, BranchQual=] errorCode=XA_RETRY
      oracle.jdbc.xa.OracleXAException
      at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:498)
      at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:190)
      at org.jboss.tm.TxCapsule.startResource(TxCapsule.java:1180)
      at org.jboss.tm.TxCapsule.enlistResource(TxCapsule.java:671)......

      I was able to do get another connection before the current connection closed using non-XADatasource. Can someone please help me to clarify this? And, how do I verify that I do get connection pooled. Thanks in advanced.

        • 1. Re: Question about XADatasource connection pool
          nsbisgod

          hi,
          first of all if you have Oracle XA Sources working please could you mail me your config file. I have not been able to create an XA Datasouce working 3.0.3 .

          • 2. Re: Question about XADatasource connection pool
            nsbisgod

            I finally got it working with Oracle! I am no expert at explaining these things, but XA Datasources basically let you commit stuff across databases. So if you have a transaction spanning across multiple databases, you need to create a XA Datasource.

            • 3. Re: Question about XADatasource connection pool
              nsbisgod

              oops! I thinks I answered the wrong query...too many threads open in too many windows...sorry my bad! Please ignore my last reply.

              • 4. Re: Question about XADatasource connection pool
                lj123w

                It is very nice to see my post finally got answered. I've been searching for answers for the past few weeks. Fortunately, I did get my problem solved just two days ago. I'm new in J2EE technology and no expert too. Here are two points about the XADatasource that I learned from some articles: 1)you can not mixed global transactions and local transactions in a method. Although, I still not quite understand why I had mixed transactions in my case (try to open/get two connections from the same XADatasource in the same method) 2)a JTA transaction can be started implicitly or automatically by the EJB container if an EJB bean uses container managed transaction specification. My problem is right here since I use container managed session bean for my testing. Once I modified the ejb-jar.xml (changed it to Bean managed), all errors were gone.

                • 5. Re: Question about XADatasource connection pool
                  imdkidd

                  Can either or you offer any insight on how you got it to work? I've been able to bind the Oracle XA Datasource but haven't been able to retrieve a connection from the pool.