3 Replies Latest reply on Oct 25, 2013 11:05 AM by Wolf-Dieter Fink

    DB2 DB connection - Jboss 7.1.1

    eramesh.java Newbie

      Hi Team,

       

      We are doing migration from Jboss4 to Jboss 7.1.1 Final.

       

      I am not able to connect DB2.

       

      Please find my ds.xml file which is currently working in Jboss4.

       

      <datasources>

        <local-tx-datasource>

          <jndi-name>jdbc/exampleDS</jndi-name>

          <connection-url>jdbc:as400://xxxxx;transaction isolation=none</connection-url>

          <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>

          <user-name>xxx</user-name>

          <password>xxx</password>

          <min-pool-size>0</min-pool-size>

        <background-validation>true</background-validation>

        <background-validation-minutes>3</background-validation-minutes>

        <new-connection-sql> SELECT COUNT(*) FROM xxxx </new-connection-sql>

        <check-valid-connection-sql> SELECT COUNT(*) FROM xxxx</check-valid-connection-sql>

          <metadata>

            <type-mapping>DB2/400</type-mapping>

          </metadata>

        </local-tx-datasource>

       

       

      Accordingly I have configured in standalone.xml  file

       

      <datasource jndi-name="java:jboss/datasources/exampleDS" pool-name="exampleDS" enabled="true" use-ccm="false">

                          <connection-url>>jdbc:as400://xxx;transaction isolation=none</connection-url>

                          <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>

                          <driver>oracle</driver>

                          <new-connection-sql>SELECT COUNT(*) FROM xxx</new-connection-sql>

                          <security>

                              <user-name>xxx</user-name>

                              <password>xxx</password>

                          </security>

                          <validation>

                              <check-valid-connection-sql>SELECT COUNT(*) FROM xxx</check-valid-connection-sql>

                              <validate-on-match>false</validate-on-match>

                              <background-validation>true</background-validation>

                              <background-validation-millis>3</background-validation-millis>

                          </validation>

                          <statement>

                              <share-prepared-statements>false</share-prepared-statements>

                          </statement>

                      </datasource>

       

                     <drivers>

                          <driver name="db2" module="com.ibm.as400">

                               <xa-datasource-class>com.ibm.as400.access.AS400JDBCDriver</xa-datasource-class>

                          </driver>

                     </drivers>

       

      Module.xml

       

      <module xmlns="urn:jboss:module:1.0" name="com.ibm.as400">
      <resources>
      <resource-root path="jt400.jar"/>
      </resources>

      <dependencies>  
      <module name="javax.api"/>
      <module name="javax.transaction.api"/>
      </dependencies>
      </module>

       

      Now I am getting the below exception.

       

      JBAS014775: New missing/unsatisfied dependencies: service jboss.jdbc-driver.oracle (missing) dependents:

       

      Could you please advise!

       

      Regards,

      Kumar

       

       

        • 1. Re: DB2 DB connection - Jboss 7.1.1
          Tomas Remes Expert

          You probably don't  have defined any driver with name "oracle". Your driver is called "d2" according to <driver name="db2" module="com.ibm.as400">. Next I am not really sure about your connection url. Shouldn't this start with "jdbc:db2" prefix? I guess so. I also guess that you can't specify transaction isolation in your connection url. There's special element for this. You can check jboss-as-datasources_1_0.xsd in your $JBOSS_HOME/docs/schema. This might be useful DB2 datasource (non-XA) working for JBoss AS 7.1.1 as well.

          • 2. Re: DB2 DB connection - Jboss 7.1.1
            eramesh.java Newbie

            Hi Tomas,

             

            Thanks for the reply.

             

            I have modified the driver name to d2.

            But, I have placed jt400.jar in the modules folder under  \ jboss-as-7.1.1.Final\modules\com\ibm\as400\main.

             

            Is this the right jar & is this the right place?

             

            Please advise!

            • 3. Re: DB2 DB connection - Jboss 7.1.1
              Wolf-Dieter Fink Master

              the modul name is the directory. So com/ibm/as400 is the correct path for the module com.ibm.as400.

              As you might have several versions of this module the default slot is "main" if you not set a module slot.

              So yes the directory is correct.

               

              If the jt400.jar is compatible with the used DB and JVM it should work. But for that you might have a look to the DB site.

               

              What error message do you see if you start the server? JBAS014775 is only a following message, not the reason of the failure if the module can not be loaded.