Creating XA DataSource to DB2 on JBoss

一曲冷凌霜 提交于 2019-12-05 17:13:28

The solution is not to use the URL to specify the connection settings.

<xa-datasource>
    <jndi-name>jdbc/DB2ServerDS</jndi-name>
    <use-java-context>false</use-java-context>
    <track-connection-by-tx>true</track-connection-by-tx> 
    <xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DB2ExceptionSorter</exception-sorter-class-name>
    <xa-datasource-property name="ServerName">db2server</xa-datasource-property>
    <xa-datasource-property name="PortNumber">50000</xa-datasource-property>
    <xa-datasource-property name="DatabaseName">FINDB</xa-datasource-property>
    <xa-datasource-property name="DriverType">4</xa-datasource-property>
    <xa-datasource-property name="User">findbuser</xa-datasource-property>
    <xa-datasource-property name="Password">findbuser</xa-datasource-property>
    <xa-datasource-property name="DriverType">4</xa-datasource-property>
    <check-valid-connection-sql>SELECT * FROM ACC.SETTINGS 1=2</check-valid-connection-sql>
    <user-name>findbuser</user-name>
    <password>findbuser</password>
    <min-pool-size>2</min-pool-size>
    <max-pool-size>10</max-pool-size>
    <blocking-timeout-millis>10000</blocking-timeout-millis>
    <type-mapping>DB2</type-mapping>
    <no-tx-separate-pools/>
</xa-datasource>

Credit to http://dev.wavemaker.com/forums/?q=node/3127

The correct JARs are

db2jcc_license_cu.jar             
db2jcc4.jar                         
db2jcc_license_cisuz.jar

Should you get an error like:

org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-5042, SQLSTATE=     , SQLERRMC= ;1208;FINDBUSER;FINDB;QDB2; ; ; ;1208; , DRIVER=4.7.85)

check http://www-01.ibm.com/support/docview.wss?uid=swg21405243&myns=swgimgmt&mynp=OCSSEPGG&mync=R for the solution.

I hope this saves others some frustration and time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!