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.
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org