0 Replies Latest reply on Aug 19, 2003 9:36 PM by wisaner

    Informix db connection error!

    wisaner Newbie

      hello

      i am useing jboss-3.2.1_tomcat-4.1.24 and IBM Informix JDBC Driver 2.21.JC5.

      i want get a connection by pool.

      my -ds.xml file like this:

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

      <xa-datasource>
      <jndi-name>misdbfortest</jndi-name>
      <xa-datasource-class>com.informix.jdbcx.IfxXADataSource</xa-datasource-class>
      <!--xa-datasource-property name="IfxWAITTIME">10</xa-datasource-property-->
      <xa-datasource-property name="Description">Something Descriptive</xa-datasource-property>
      <xa-datasource-property name="IfxIFXHOST">192.168.0.220</xa-datasource-property>
      <xa-datasource-property name="PortNumber">8888</xa-datasource-property>
      <xa-datasource-property name="DatabaseName">testdb</xa-datasource-property>
      <xa-datasource-property name="ServerName">mydb</xa-datasource-property>
      <!-- not sure if these should be here-->
      <user-name>abc</user-name>
      abc
      </xa-datasource>



      in session bean A, i want get the Connection and the method like this:

      public java.sql.Connection getConn() throws Exception {
      InitialContext ctx = new InitialContext();
      javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("java:comp/env/jdbc/misdb");
      System.out.println(ds.toString());
      java.sql.Connection conn = null;
      Statement stmt = null;
      try {

      conn = ds.getConnection();

      if (conn != null)
      System.out.println("ok");
      else
      System.out.println("error");
      }
      catch (SQLException sqlEx) {
      System.out.println("Error connect to pool.");
      System.out.println( "=====failed reason is:=============" );
      System.out.println( sqlEx.toString() );
      }
      return conn;
      }


      and the ejb-jar.xml file like this:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <display-name>testinfopool</display-name>
      <ejb-name>testinfopool</ejb-name>
      testpool.testinfopoolHome
      testpool.testinfopool
      <ejb-class>testpool.testinfopoolBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <resource-ref>
      DataSource for the Titan database
      <res-ref-name>jdbc/misdb</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </enterprise-beans>
      <assembly-descriptor>
      <container-transaction>

      <ejb-name>testinfopool</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>


      jboss.xml file like this:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">

      <enterprise-beans>

      <ejb-name>testinfopool</ejb-name>
      <jndi-name>testinfopool</jndi-name>
      <resource-ref>
      <res-ref-name>jdbc/misdb</res-ref-name>
      <jndi-name>java:/misdbfortest</jndi-name>
      </resource-ref>

      </enterprise-beans>



      but when program run, it throws the error like this :

      11:00:27,829 INFO [STDOUT] =====failed reason is:=============
      11:00:27,829 INFO [STDOUT] org.jboss.util.NestedSQLException: Could not find ac
      cessor on XADataSource: ; - nested throwable: (java.lang.NoSuchMethodException:
      com.informix.jdbcx.IfxXADataSource.setIfxWAITTIME(java.lang.String)); - nested t
      hrowable: (org.jboss.resource.JBossResourceException: Could not find accessor on
      XADataSource: ; - nested throwable: (java.lang.NoSuchMethodException: com.infor
      mix.jdbcx.IfxXADataSource.setIfxWAITTIME(java.lang.String)))

      how can i get the correct connection,
      thanks