config Tomcat 5 DPCP with Informix 9.21
Posted in 2004
Topics: Connectivity: ODBC / JDBC / .NET, Connectivity: ESQL/C, 4GL & Embedded SQL, Security, Permissions & Auditing, Java & JDBC Development, Cloud, Docker & Containers
Hi, I am trying to config Tomcat5 DBCP with Informix 9.21. However, I get java exception when getting database connection from data source. Here are my configuration: server.xml: <Resource auth="Container" description="DB Connection" name="jdbc/testdb" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/testdb"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <parameter> <name>username</name> <value>xxxxx</value> </parameter> <parameter> <name>password</name> <value>xxxxx</value> </parameter> <parameter> <name>driverClassName</name> <value>com.informix.jdbc.IfxDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:informix-sqli://192.168.150.1:1535/testdb:informixserver=ol_dbserver</value> </parameter> </ResourceParams> web.xml: <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/testdb</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> code fragment of my servlet: Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/testdb"); Connection conn = ds.getConnection(); // exception throw at this line Java Exception of servlet: org.apache.commons.dbcp.SQLNestedException:Cannot get a connection ,pool exhausted,cause: java.util.NoSuchElementException:could not create a validate object Does anybody meet this problem? Is it the problem of informix jdbc driver? Actually, I don't have any problem when working Tocmat5 DBCP with other database server (eg. PostgreSQL). Thank you. ps. I've already copied all Informix JDBC related jar files to $TOMCAT_HOME/common/lib
I suspect the exception is being thrown even before any calls are being made to IBM Informix JDBC driver. To verify same , you can turn on IBM informix JDBC driver tracing by adding following to your connection string. "PROTOCOLTRACE=99;PROTOCOLTRACEFILE=/tmp/jdbc_ptrace;TRACE=99;TRACEFILE=/tmp/jdbc_functiontrace"; You should get a protocol trace in /tmp/jdbc_ptrace and a function call trace in /tmp/jdbc_functiontrace. To be able to generate a trace file , you need to have ifxjdbc-g.jar in your CLASSPATH (Note that having ifxjdbc.jar in CLASSPATH will not generate any trace). Refer to IBM Informix JDBC Programmers manual page 7-4 and 7-5 for further details. http://publibfi.boulder.ibm.com/epubs/pdf/ct1utna.pdf. If JDBC driver is throwing an exception you should see something to the effect in the trace files generated.