8 Replies Latest reply on Jul 19, 2002 5:21 AM by Tung Dang

    Sample files for DB2 Connection

    Tung Dang Novice

      I am using:

      JBoss 3.0
      DB2 V 7.2
      JDK 1.3

      Could someone help post sample files(jbosscmp-jdbc.xml, standardjbosscmp-jdbc.xml, db2-service.xml, ...etc.) or a simple project for connection to DB2 and using datasource, connection pooling features ?

      Regards

        • 1. Re: Sample files for DB2 Connection
          Steve Conway Newbie

          Attached files are a sample for the CD example using DB2 running on AS/400 if this helps you.
          The db2-as400-service.xml uses a name of AS400DS and uses the jdbc driver 'com.ibm.as400.access.AS400JDBCDriver' (found in jt400.jar) and connection string 'jdbc:as400://hostname/collectionname'.
          Note that the jndi name in jbosscmp-jdbc.xml is
          'java:/AS400DS'
          This is probable not quite what you are after, but it might help.
          Regards,
          Steve

          • 2. Re: Sample files for DB2 Connection
            Tung Dang Novice

            First thank you very much!

            Is it correct, that the db2-as400-service.xml file must be copied in %JBOSS_INST%/server/default/deploy/ and the jbosscmp-jdbc.xml file must be packed with your bean?

            Regards

            • 3. Re: Sample files for DB2 Connection
              Joe Simone Newbie

              I am using JBoss 3.0 with IBM DB2 EE 7.2 and fixpack 7 and it is working well.

              • 4. Re: Sample files for DB2 Connection
                Joe Simone Newbie

                Also, also I forgot to mention that you must copy db2java.zip to the %JBOSS_HOME%\server\default\deploy directory. Make sure this JDBC driver that JBOSS uses matches the current driver in the DB2 installation (DB2 java directory). Please NOTE the driver has been upgraded in fixpack 7 and JBoss should have this new level to match.

                Finally, DB2 has a limitation on PK constraint names of 18 chars. So make sure to keep relationship names short and concise or you will get driver exceptions.

                Enjoy!

                joe

                • 5. Re: Sample files for DB2 Connection
                  Tung Dang Novice

                  I am not sure about the location of the files. I have the following files:

                  - db2java.zip
                  - db2-service.xml
                  - jbosscmp-jdbc.xml
                  - jboss.xml
                  - ejb-jar.xml
                  - ProductBean.class
                  - Product.class
                  - ProductHome.class

                  I created a product.jar file containing the following files:

                  - jbosscmp-jdbc.xml
                  - jboss.xml
                  - ejb-jar.xml
                  - ProductBean.class
                  - Product.class
                  - ProductHome.class

                  Then I copied the files db2java.zip, db2-service.xml and product.jar into the directory %JBOSS_INST%\server\default\deploy. Is the location of the files correct?

                  Thanks.

                  P.S. Do I need an own standardjbosscmp.jdbc.xml because JBoss has one.

                  • 6. Re: Sample files for DB2 Connection
                    Tung Dang Novice

                    I am not sure about the location of the files. I have the following files:

                    - db2java.zip
                    - db2-service.xml
                    - jbosscmp-jdbc.xml
                    - jboss.xml
                    - ejb-jar.xml
                    - ProductBean.class
                    - Product.class
                    - ProductHome.class

                    I created a product.jar file containing the following files:

                    - jbosscmp-jdbc.xml
                    - jboss.xml
                    - ejb-jar.xml
                    - ProductBean.class
                    - Product.class
                    - ProductHome.class

                    Then I copied the files db2java.zip, db2-service.xml and product.jar into the directory %JBOSS_INST%\server\default\deploy. Is the location of the files correct?

                    Thanks.

                    P.S.: Do I need an own standardjbosscmp.jdbc.xml because JBoss has one.

                    • 8. Re: Sample files for DB2 Connection
                      Tung Dang Novice

                      I could solve the problem.

                      First I had the wrong version of JBoss.
                      I renamed db2java.zip to db2java.jar and then copied it into %JBOSS_INST%\server\default\lib. The db2-service.xml file was copied into %JBOSS_INST%\server\default\deploy. The rest of the file was packed to a product.jar. This file also located in %JBOSS_INST%\server\default\deploy.

                      I could successfully deploy my datasource, but I got another error message:

                      2002-07-19 10:08:29,000 ERROR [org.jboss.deployment.MainDeployer] could not create deployment: file:/C:/Programme/jboss 3.0/server/default/deploy/product.jar
                      org.jboss.deployment.DeploymentException: Error in jboss.xml for Bean Product: configuration '' not found in standardjboss.xml or jboss.xml
                      at org.jboss.metadata.ApplicationMetaData.importJbossXml(ApplicationMetaData.java:544)
                      at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:184)
                      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:326)
                      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
                      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
                      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
                      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                      at $Proxy4.deploy(Unknown Source)
                      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:405)
                      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:586)
                      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:465)
                      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:237)
                      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:162)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
                      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:894)
                      at $Proxy0.start(Unknown Source)
                      at org.jboss.system.ServiceController.start(ServiceController.java:340)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
                      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                      at $Proxy3.start(Unknown Source)
                      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:243)
                      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:678)
                      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:513)
                      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
                      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:465)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
                      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:314)
                      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:216)
                      at org.jboss.Main.boot(Main.java:142)
                      at org.jboss.Main$1.run(Main.java:375)
                      at java.lang.Thread.run(Thread.java:479)
                      2002-07-19 10:08:29,062 ERROR [org.jboss.deployment.scanner.URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@c5979c37{ url=file:/C:/Programme/jboss 3.0/server/default/deploy/ac.jar, deployedLastModified=0 }

                      What does this mean?