title: Creating XA DataSource to DB2 on JBoss
body: <p>I trying to configure an XA DB2 DataSource, <code>xa-datasource</code> (based on <a href="http://community.jboss.org/wiki/SetUpADB2Datasource" rel="nofollow">http://community.jboss.org/wiki/SetUpADB2Datasource</a>) using <code>com.ibm.db2.jcc.DB2XADataSource</code> class (<code>local-tx-datasource</code> works using the <code>com.ibm.db2.jcc.DB2Driver</code>). The target server is DB2 Connect V9.7</p>
  
  <p>Actual xa-datasource config:</p>
  
  <pre><code>&lt;xa-datasource&gt;
      &lt;jndi-name&gt;jdbc/DB2ServerDS&lt;/jndi-name&gt;
      &lt;use-java-context&gt;false&lt;/use-java-context&gt;
      &lt;track-connection-by-tx&gt;true&lt;/track-connection-by-tx&gt; 
      &lt;xa-datasource-class&gt;com.ibm.db2.jcc.DB2XADataSource&lt;/xa-datasource-class&gt;
      &lt;xa-datasource-property name="URL"&gt;jdbc:db2://db2server:50000/FINDB&lt;/xa-datasource-property&gt;
      &lt;exception-sorter-class-name&gt;org.jboss.resource.adapter.jdbc.vendor.DB2ExceptionSorter&lt;/exception-sorter-class-name&gt;
      &lt;xa-datasource-property name="DriverType"&gt;4&lt;/xa-datasource-property&gt;
      &lt;check-valid-connection-sql&gt;SELECT * FROM ACC.SETTINGS 1=2&lt;/check-valid-connection-sql&gt;
      &lt;user-name&gt;findbuser&lt;/user-name&gt;
      &lt;password&gt;findbuser&lt;/password&gt;
      &lt;min-pool-size&gt;2&lt;/min-pool-size&gt;
      &lt;max-pool-size&gt;10&lt;/max-pool-size&gt;
      &lt;blocking-timeout-millis&gt;10000&lt;/blocking-timeout-millis&gt;
      &lt;type-mapping&gt;DB2&lt;/type-mapping&gt;
      &lt;no-tx-separate-pools/&gt;
  &lt;/xa-datasource&gt;
  </code></pre>
  
  <p>and the following jar in the JBoss node lib directory:</p>
  
  <pre><code>db2umplugin.jar         
  db2policy.jar           
  db2dbgm.jar             
  db2jcc_license_cu.jar   
  db2jcc.jar              
  db2jcc4.jar             
  db2java.zip             
  db2jcc_license_cisuz.jar
  </code></pre>
  
  <p>but i'm getting the error:</p>
  
  <pre><code>Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][3.57.82] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path:  ERRORCODE=-4472, SQLSTATE=null
  </code></pre>
  
  <p>The driver for XA is trying to use native libraries, despite the fact that i'm using a JDBC Type 4 driver.</p>
  
  <p>Why is the driver trying to use native libraries? Is there anything i need to add to my config?</p>