3 Replies Latest reply on Dec 4, 2006 11:31 AM by bulledesavon

    [JBoss + M$ SQLServer 2005 driver] XA Datasource definition

    bulledesavon

      Hi,

      I'm trying to define a XA DataSource on JBoss 4.0.3SP1 (same problem with 4.0.4GA) using the Microsoft SQLServer 2005 driver version 1.1.

      Here is the content of my datasource-ds.xml file :
      <?xml version="1.0" encoding="UTF-8"?>


      <xa-datasource>
      <jndi-name>jdbc/mydatasource</jndi-name>
      <track-connection-by-tx>True</track-connection-by-tx>
      <connection-url>jdbc:inetdae7</connection-url>
      <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>

      <xa-datasource-property name="DatabaseName">myDB</xa-datasource-property>
      <xa-datasource-property name="ServerName">myServer</xa-datasource-property>
      <xa-datasource-property name="Port">1433</xa-datasource-property>
      <xa-datasource-property name="ApplicationName">myAppName</xa-datasource-property>
      <xa-datasource-property name="SelectMethod">cursor</xa-datasource-property>
      <xa-datasource-property name="SendStringParametersAsUnicode">true</xa-datasource-property>

      <user-name>myUser</user-name>

      <min-pool-size>1</min-pool-size>
      <max-pool-size>5</max-pool-size>
      <new-connection-sql>select 1 from systypes</new-connection-sql>
      <check-valid-connection-sql>select 1 from systypes</check-valid-connection-sql>
      </xa-datasource>



      Pay attention to the port number property line.

      When the DataSource is created, I get the following exception :

      2006-11-30 10:11:45,667 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Could not find accessor on XADataSource: ; - nested throwable: (java.lang.NoSuchMethodException: com.microsoft.sqlserver.jdbc.SQLServerXADataSource.setPort(java.lang.String)))
      at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:153)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:519)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:208)
      at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:529)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:410)
      at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:342)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:462)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)


      It is showed in the log file as a Warning, but the DataSource is not useable at all.
      It seems that JBoss can't find out that the parameter of the setPort method is an int and not a String...

      If I comment out the port property line, everything is fine.


      Any hint?
      Is this JBoss related or driver related?

      Thanks,

      BdS