View Full Version : connection pool, tomcat, mysql

07-09-2008, 07:15 AM
1. searching found nothing on this forum
2. does onyone has his/her own instruction how hi/she did it (tomcat/mysql)
3 after toon of googling found nothinhg that would support my idea:
3.1 call servlet - get connection from pool of connections
3.2 call servlet - return connection to pool of connections
4. found no cases on google where connection would be pulled out od pool
from java class

Any advice velcome.

07-09-2008, 08:37 PM
Tomcat has built in support for connection pooling using JNDI, but I was never able to get it working.

There is all kinds of information about managing a connection pool that comes up from a Google Search, here is first result:


All you would need to do in your case is use the servlets doGet or doPost method and use a request parameter to specify rather you are asking for or returning a connection to/from the pool. Initialize the pool when the servlet initializes and control it all through the servlet requests.

07-09-2008, 09:28 PM
ok, I found some usable source:
and managed to get it working
What it basicaly does is open connection on request, put it in pool and let it live for 5 minutes,mean while it is usable for other requests, untested doh.

sub question;

can it be somehoew done this:

ResultSet rs = stmt.executeQuery(query);

instead of



07-13-2008, 08:32 PM
ok, implemented: http://proxool.sourceforge.net/

and it looks that it works fine, but take a look at this, is this ok ?

look at getconnection, setdataset, executesql

Edit: hmm, seems this is summary (Self time)