6 Replies Latest reply on May 27, 2010 11:08 AM by Robert Heim

    Use LastResource Optimization w/ SQL Server JDBC Driver (2.0+)

    Robert Heim Newbie

      We are in the process of migrating our existing JBoss 4.0.4 application to 5.1.0.

       

      Our original application uses jTDS and the LastResource optimization to simulate XA functionality with our Oracle XA datasources.

       

      We would like to try and replace jTDS with the current JDBC Drivers supplied by Microsoft. 

       

      In the past we were able to make this work by building a wrapper class which extended net.sourceforge.jtds.jdbcx.JtdsDataSource which implemented LastResource.

       

       

      package com.system.jdbc.xa;
      import org.jboss.tm.LastResource;
      public class JtdsJBossLastResourceDataSource extends net.sourceforge.jtds.jdbcx.JtdsDataSource implements LastResource 
      {
      }
      
      
      

       

      We have been trying to duplicate that with the JDBC Driver provided by Microsoft (both rev 2.0 and 3.0) but we have not had any luck.

       

      The JtdsDataSource class implements both a regular as well as a XA datasource.  We have tried replacing the code above with either.

       

       

      public class MsftJBossLastResourceDataSource extends com.microsoft.sqlserver.jdbc.SQLServerDataSource implements LastResource 
      
      
      

       

      When we try the example above, the code compiles but when the server is started we receive an error saying that it cannot cast to a java.sql.XADataSource.

       

      public class MsftJBossLastResourceDataSource extends com.microsoft.sqlserver.jdbc.SQLServerXADataSource implements LastResource 
       
      

       

      However, when we try to compile this, we can't since Microsoft has made this class FINAL can thus is cannot be extended.

       

      Has anyone had any luck with implementing the LastResource optimization with the Microsoft JDBC driver (rev 2.0 or higher)?

       

      Thanks in advance for your help with this.