,错误如下:
16:26:14,605 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException:
Could not create connection; - nested throwable: (java.lang.ClassCastException)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.
createManagedConnection(XAManagedConnectionFactory.java:162)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.
createConnectionEventListener(InternalManagedConnectionPool.java:539)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.
allocateConnection(BaseConnectionManager2.java:812)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
这个错误耽误很长时间,后来突然发现,Sybase的jConnect驱动,竟然没有实现javax.sql.XADataSource的接口。
于是,搜索了一下是否还有其他商业驱动支持Sybase IQ,但发现只有Sybase自身的jConnect。
到这里好像Sybase IQ不支持XA,但是随后做了一个大胆的测试,就是对Sybase使用sybase-ds.xml,而对SQLServer依然采用mssql-xa-ds.xml。sybase-ds.xml配置如下:
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/SybaseDB</jndi-name>
<connection-url>jdbc:sybase:Tds:localhost:2638</connection-url>
<driver-class>com.sybase.jdbc3.jdbc.SybDataSource</driver-class>
<user-name>dba</user-name>
<password>sql</password>
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.SybaseExceptionSorter
</exception-sorter-class-name>
<metadata>
<type-mapping>Sybase</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>