0 Replies Latest reply on Nov 20, 2012 9:51 AM by Marco Sarti

    XADatasource and Oracle RAC - Load Balancing

    Marco Sarti Newbie

      JBoss 4.2.3 GA - Oracle 11g RAC

       

      We have configured a XADatasource pointing to an Oracle RAC. When we get the connection from this datasource we do not obtain any load balancing, in other words every time we ask for a connection we obtain a connection to the same RAC node.

      How can we configure the DS in order to have a load balancing on the RAC nodes?

       

      Following the datasource configuration:

       

      <jndi-name>jdbc/xxxxxxxx</jndi-name>

          <track-connection-by-tx/>

          <isSameRM-override-value>false</isSameRM-override-value>

          <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>

              <xa-datasource-property  name="URL">jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(protocol=tcp)(host=rac-scan)(port=xxx))(LOAD_BALANCE=YES)(CONNECT_DATA=(SERVE

      R=DEDICATED)(SERVICE_NAME=dbname.domain)))</xa-datasource-property>

          <xa-datasource-property name="User">XXXXXX</xa-datasource-property>

          <xa-datasource-property name="Password">YYYYYY</xa-datasource-property>

          <min-pool-size>0</min-pool-size>

          <max-pool-size>60</max-pool-size>

          <idle-timeout-minutes>2</idle-timeout-minutes>

          <blocking-timeout-millis>30000</blocking-timeout-millis>

              <!--sql to call when connection is created-->

              <new-connection-sql>select 1 from dual</new-connection-sql>

              <!--sql to call on an existing pooled connection when it is obtained from pool-->

              <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>

          <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->

          <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->

          <!-- Checks the Oracle error codes and messages for fatal errors -->

          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

          <!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global transaction and vice-versa -->

          <no-tx-separate-pools/>