0 Replies Latest reply on Nov 2, 2011 4:11 AM by baecks

    XA datasource (with failover) in JBOSS AS 5.1

    baecks

      Hello,

       

      For a JEE app running on JBOSS AS 5.1, I've set up a XA datasource (using JTDS to connect to a MS SQL 2008 database). The *-ds.xml file is shown below. I've set up database redundancy (2 SQL server instances being mirrored). So I want the datasource to fail-over to the second database server if the first one fails. I got this working for the non-XA datasources. For this XA-datasource however I'm still not able to get it working, although I followed the documentation from JBOSS.org:

      - adding the <url-delimiter> tag: <url-delimiter>|</url-delimiter>

      - adding an URL property: <xa-datasource-property name="URL">10.50.67.80|10.50.67.81</xa-datasource-property>

      - adding the <url-property> tag: <url-propert>URL</url-property>

      - remove the <xa-datasource-property name="ServerName> tag.

       

      The only result is a non-working datasource and a server log entry saying that the JTDS driver doesn't support a property named "URL". I'd prefer to make this work with the jtds driver. However if the MS provided JDBC driver should be required, that's something that we could consider.

       

      All help to make this work is very appreciated.

       

      WsDatasource-ds.xml file (without the fail-over):

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE datasources PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN" "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">

      <datasources>

                <xa-datasource>

                          <jndi-name>WsDatasource</jndi-name>

                          <track-connection-by-tx/>

                          <xa-datasource-class>net.sourceforge.jtds.jdbcx.JtdsDataSource</xa-datasource-class>

                          <xa-datasource-property name="ServerName">10.50.67.80</xa-datasource-property>

                          <xa-datasource-property name="PortNumber">1433</xa-datasource-property>

                          <xa-datasource-property name="DatabaseName">videoscape41</xa-datasource-property>

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

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

                          <!--  uncomment following if SQL SERVER is being run as a named instance -->

                          <!--  <xa-datasource-property name="Instance">@db.instance@</xa-datasource-property> -->

                          <xa-datasource-property name="XaEmulation">true</xa-datasource-property>

       

       

                          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

       

                          <min-pool-size>10</min-pool-size>

                          <max-pool-size>30</max-pool-size>

       

                          <blocking-timeout-millis>5000</blocking-timeout-millis>

                          <idle-timeout-minutes>15</idle-timeout-minutes>

       

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

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

       

       

                          <metadata>

                                    <type-mapping>MS SQLSERVER</type-mapping>

                          </metadata>

                </xa-datasource>

      </datasources>