tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pete <pwkp...@yahoo.com>
Subject DB2/Tomcat Connection pooling problem
Date Fri, 02 Feb 2007 18:46:24 GMT

Hello all,
I am currently working on getting Tomcat and DB2 to work together here and have been having
a heck of a time.
I'm at a point where I'm able to reference the JNDI resource in my test servlet (finally),
and now am getting a connection pool issue: "Cannot create
PoolableConnectionFactory"

I am running Tomcat 6.0.x. I know there were some changes to resource definitions at some
point in v5, is there anything that changed in v6 that I could be missing? At what point do
I declare a factory in the resource and how/why is that used?
To access the database, I use the following code:
                javax.sql.DataSource DS2 = (javax.sql.DataSource)ctx.lookup("java:/comp/env/jdbc/PhoenixDB");
                Connection con = DS2.getConnection();
If I add a factory attribute to context.xml (listed below), getConnection() returns null:
 factory="com.ibm.db2.jcc.DB2DataSourceFactory"

I have seen many examples with 'how-to's", many of them don't specify versions and it's hard
to tell what belongs to what.

Also in V6, it seems to be using a version of dbcp associated with tomcat as opposed to commons.
(org.apache.tomcat.dbcp.*) Has some underlying behavior changed as well here?

Thanks!
-P

Following is information related to my setup:
--------

META-INF/context.xml:
<Context>
<Resource name="jdbc/PhoenixDB"
        auth="Container"
        type="javax.sql.DataSource"
        driverClassName="com.ibm.db2.jcc.DB2Driver"
        validationQuery="SELECT 1"
        loginTimeout="10"
        connectionProperties="currentSchema=T;"
        maxWait="5000"
        username="uid"
        password="pwd"
        testOnBorrow="true"
        driverType="4"
        url="jdbc:db2://test:50000/TDB"
        />
</Context>

Stacktrace:
DS2 : org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (DB2 SQL error: SQLCODE: -104, SQLSTATE:
42601, SQLERRMC: ;;+ - AS )
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (DB2 SQL error: SQLCODE: -104, SQLSTATE:
42601, SQLERRMC: ;;+ - AS )
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
	at TestServlet.performTask(TestServlet.java:49)
	at TestServlet.doGet(TestServlet.java:17)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:866)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:716)
	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1498)
	at java.lang.Thread.run(Unknown Source)
Caused by: com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601,
SQLERRMC: ;;+ - AS 
	at com.ibm.db2.jcc.b.zc.e(zc.java:1606)
	at com.ibm.db2.jcc.b.zc.a(zc.java:1206)
	at com.ibm.db2.jcc.a.db.h(db.java:149)
	at com.ibm.db2.jcc.a.db.a(db.java:43)
	at com.ibm.db2.jcc.a.r.a(r.java:30)
	at com.ibm.db2.jcc.a.sb.g(sb.java:152)
	at com.ibm.db2.jcc.b.zc.n(zc.java:1186)
	at com.ibm.db2.jcc.b.zc.a(zc.java:1857)
	at com.ibm.db2.jcc.b.zc.a(zc.java:497)
	at com.ibm.db2.jcc.b.zc.executeQuery(zc.java:481)
	at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
	at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:328)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:879)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
	... 17 more




 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message