tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael-O <>
Subject Re: Tomcat7 - ajax and connection pool : "connection closed" despite the use of "validationQuery" and "testOnBorrow"
Date Fri, 05 Apr 2013 10:40:45 GMT
Am 2013-04-05 11:37, schrieb Jean-Claude Haw-King-Chon:
> Hi,
> I use the connection pool of tomcat7 and set a connection in a
> ThreadLocal. The context is a web application : the threadLocal is
> configured when the http request is initialized. The jdbc connection is
> closed and removed from the threadLocal when the resquest is destroyed.

Why do you do that at all?
Why don't you simply use such an idiom in your thead/controller:

Connection conn = ConnetionUtils.getReadWriteConnection(DataSource 
dataSource); // has to be implemented of course

Use this connetion in the entire thread, pass it along, when you are 
done. Close it.

ThreadLocals are useful in other cases but not in this one.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message