2 Replies Latest reply on Feb 12, 2004 11:39 AM by rupshall

    AS400/DB2 help

    rupshall Newbie

      Hi,

      I am new to JBoss and I am encountering a couple problems configuring my datasource. I have tried to use xa and non-xa methods, both appear to partially work but neither completely works.

      When I use the non-xa method I have the following

      as400-ds.xml:


      <local-tx-datasource>
      <jndi-name>as400</jndi-name>
      <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
      <connection-url>jdbc:as400:://server</connection-url>
      <connection-property name="driver">toolbox</connection-property>
      <connection-property name="libraries">testlib, *LIBL</connection-property>
      <connection-property name="naming">sql</connection-property>
      <connection-property name="user">xxx</connection-property>
      <connection-property name="password">yyy</connection-property>
      <connection-property name="access">all</connection-property>
      <connection-property name="char.encoding">UTF-8</connection-property>
      <application-managed-security/>
      </local-tx-datasource>



      useing this datasource file I have the following issues:
      1. when I deploy an entity bean it prompts me with a swing signon for the JDBC driver, it ignores username and password from as400-ds.xml
      2. it will create the table, deleate the table, allow me to lookup by key but I get this error when I try to create "javax.ejb.CreateException: Could not create entity:java.sql.SQLException: [SQL7008] TSTABLE in TESTLIB not valid for operation."




      when I use the xa method :

      as400-xa-ds.xml



      <xa-datasource>
      <jndi-name>as400</jndi-name>

      <xa-datasource-class>com.ibm.as400.access.AS400JDBCXADataSource</xa-datasource-class>
      <xa-datasource-property name="ServerName">server</xa-datasource-property>
      <xa-datasource-property name="Libraries">testlib</xa-datasource-property>
      <xa-datasource-property name="User">xxxx</xa-datasource-property>
      <xa-datasource-property name="Password">yyyy</xa-datasource-property>
      </xa-datasource>




      useing this method I have the following problem:
      1. it creates the table, deletes the table but when I try to create or find by key I get "javax.ejb.CreateException: Error checking if entity exists:org.jboss.util.NestedSQLException: Failure to delist resource;"



      I am new to this and not sure what the benefits of one ds type over another would be, if somebody could enlighten me on that it would be great.

      My biggest concern is just getting one of these approaches to work and worry about the other later.

      Thanks for any help,
      Robert

        • 1. Re: AS400/DB2 help
          Franco Apprentice

          Hello,
          this example work fine on multiple systems:

          <?xml version="1.0" encoding="UTF-8"?>

          <!-- ===================================================================== -->
          <!-- -->
          <!-- JBoss Server Configuration -->
          <!-- -->
          <!-- ===================================================================== -->

          <!-- $Id: mysql-ds.xml,v 1.1 2002/07/22 22:57:24 d_jencks Exp $ -->
          <!-- ==================================================================== -->
          <!-- Datasource config for AS/400 using 2.0.11 driver -->
          <!-- ==================================================================== -->



          <local-tx-datasource>
          <jndi-name>legacy</jndi-name>
          <connection-url>jdbc:as400://10.1.2.50;block size=128;extended dynamic=true;package=JBOSS;package cache=true;package library=QGPL</connection-url>
          <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
          <user-name>user</user-name>
          pwd
          </local-tx-datasource>


          • 2. Re: AS400/DB2 help
            rupshall Newbie

            Thanks for the post, I found the problem. A full day wasted because of a typo in the connection-url I had jdbc:as400:://server instead of jdbc:as400://server , that second : cost me a full day of work.

            I still get a problem when I attempt to create and Entiry Bean, here is the error from JBoss console:


            java.sql.SQLException: [SQL7008] TSTTABLE in EJBTST not valid for operation.
            at com.ibm.as400.access.JDError.throwSQLException(JDError.java:594)
            at com.ibm.as400.access.JDError.throwSQLException(JDError.java:565)
            at com.ibm.as400.access.AS400JDBCStatement.commonExecute(AS400JDBCStatement.java:742)
            at com.ibm.as400.access.AS400JDBCPreparedStatement.executeUpdate(AS400JDBCPreparedStatement.java:1102)
            at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:324)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.executeInsert(JDBCAbstractCreateCommand.java:326)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:287)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:138)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:554)
            at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:208)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:269)
            at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:737)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1043)
            at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
            at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:197)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:214)
            at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
            at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:89)
            at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
            at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
            at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
            at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
            at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
            at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:483)
            at org.jboss.ejb.Container.invoke(Container.java:720)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
            at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
            at sun.rmi.transport.Transport$1.run(Transport.java:148)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
            at java.lang.Thread.run(Thread.java:534)





            Can anybody help with this?

            Thanks again,
            Robert