title: Access AS/400 data base using JPA / Hibernate / JAVA on JBoss 7.1
body: <h1>-ORIGINAL_POST-</h1>
  
  <p>I'm currently developing a JAVA (1.7) server application running on an JBoss 7. Using Spring and Hibernate this would be nothing unusual, but I have to connect an old AS/400 DB to the system. So far I've adjusted the drivers for the application server and the database connection has been established. The application server has logged that the database has beend found.</p>
  
  <p>Now I've tried to access the data using JPA and Hibernate. But there seems to be a problem with my libraries. He is what the server is logging.</p>
  
  <p>English:</p>
  
  <blockquote>
    <p>For this file no library has been found in the SQL/ODBC files. The
    file was not found in the *CURLIB, *LIBL or the default library of the
    data base source. There is no OVRDBF or a OVRDBF has not been set.
    [...] PCSACC/400</p>
  </blockquote>
  
  <p>German original: </p>
  
  <blockquote>
    <p>Für diese Datei wurde keine Bibliothek in den SQL/ODBC-Daten
    ermittelt. Die Datei wurde nicht in der *CURLIB, *LIBL oder in der
    Default-Bibliothek der Datenquelle gefunden. Es besteht kein OVRDBF
    oder in einem OVRDBF wurde keine Bibliothek angegeben. [..] PCSACC/400</p>
  </blockquote>
  
  <p>Is my assumption right and I have to add an additional library to my EAR in order to run the queries? Another scenario would be, that the AS/400 has to be accessed in a different way - perhaps the application has connected to the db but not to the instance I need to access.</p>
  
  <p>One additional question - can I simulate this type of db?</p>
  
  <h1>-EDIT_ONE-</h1>
  
  <p>The data source onfiguration of the JBoss 'urn:jboss:domain:datasources:1.0' subsystem:</p>
  
  <pre><code>&lt;xa-datasource jta="true" jndi-name="java:/asdb" pool-name="asdb" enabled="true" use-java-context="true" use-ccm="true"&gt;
    &lt;xa-datasource-property name="ServerName"&gt;192.168.1.666&lt;/xa-datasource-property&gt;
    &lt;xa-datasource-property name="databaseName"&gt;A1B2C3D4&lt;/xa-datasource-property&gt;
    &lt;xa-datasource-property name="Libraries"&gt;DMS7_0&lt;/xa-datasource-property&gt;
    &lt;xa-datasource-property name="User"&gt;myuser&lt;/xa-datasource-property&gt;
    &lt;xa-datasource-property name="Password"&gt;myuser&lt;/xa-datasource-property&gt;
    &lt;xa-datasource-property name="naming"&gt;system&lt;/xa-datasource-property&gt;
    &lt;xa-datasource-property name="translateBinary"&gt;true&lt;/xa-datasource-property&gt;
    &lt;xa-datasource-property name="errors"&gt;full&lt;/xa-datasource-property&gt;
    &lt;driver&gt;com.ibm.as400&lt;/driver&gt;
  &lt;/xa-datasource&gt;
  </code></pre>
  
  <p>And the possible drivers:</p>
  
  <pre><code>&lt;drivers&gt;
    &lt;driver name="net.sourceforge.jtds" module="net.sourceforge.jtds"&gt;
      &lt;driver-class&gt;net.sourceforge.jtds.jdbc.Driver&lt;/driver-class&gt;
      &lt;xa-datasource-class&gt;net.sourceforge.jtds.jdbcx.JtdsDataSource&lt;/xa-datasource-class&gt;
    &lt;/driver&gt;
    &lt;driver name="com.ibm.db2" module="com.ibm.db2"&gt;
      &lt;driver-class&gt;com.ibm.db2.jcc.DB2Driver&lt;/driver-class&gt;
      &lt;xa-datasource-class&gt;com.ibm.db2.jcc.DB2XADataSource&lt;/xa-datasource-class&gt;
    &lt;/driver&gt;
    &lt;driver name="com.ibm.as400" module="com.ibm.as400"&gt;
      &lt;driver-class&gt;com.ibm.as400.access.AS400JDBCDriver&lt;/driver-class&gt;
      &lt;xa-datasource-class&gt;com.ibm.as400.access.AS400JDBCXADataSource&lt;/xa-datasource-class&gt;
    &lt;/driver&gt;
  &lt;/drivers&gt;
  </code></pre>
  
  <p>The Hibernate versions:</p>
  
  <ul>
  <li>Hibernate Core 3.6.9</li>
  <li>Hibernate JPA API 2.0</li>
  </ul>
  
  <p>The JBoss-Web-Configuration for the data source</p>
  
  <pre><code>&lt;resource-ref&gt;
    &lt;res-ref-name&gt;jdbc/ASdb&lt;/res-ref-name&gt;
    &lt;jndi-name&gt;java:/asdb&lt;/jndi-name&gt;
  &lt;/resource-ref&gt;
  </code></pre>