Im using one example of connection pool. The example have a servlet that I think make the management of the connections in the pool. My problem is to use the servlet itself. Where I store the pool? Actualy im storing the pool in one application variable but at the end of some time with multiple online users I cant get more connections from the pool. I free the connections when I dont need any more, but the application variable is not the best solution.
Jakarta Commons implements a pool for you which makes things easier. If you are writing your own, you typically use a singeton which is stored in memory (like application scope.) Of the web app options (application, session, request, page), application is the broadest.
There may still be a resource leak even if you close connections. If you post that snippet of code, we can take a look.
Im using the example of coreservlets. I think it very good but I dont know how to use it by the best way. I use the pool but I store the connections in application variable. In this case if two user access to the page at the same time is possible that the pool dont work good.
Thanks Lu�s Matos
Lu�s Matos
Greenhorn
Joined: Nov 09, 2005
Posts: 12
posted
0
Hi Jeanne Boyarsky
Do you know the example that I'm talking about?
Thanks Lu�s Matos
Sri Ram
Ranch Hand
Joined: Oct 03, 2005
Posts: 118
posted
0
Y use Application Variable to store Connections? U can Make Connection as a method variable and initialize the connection in every method and close it in finally block in the same method. Or Keep make it a Class variable and close the same at end of class. This way u can ensure that there is no leak. And also u wont run into NoMoreConnection problem.
Lu�s Matos
Greenhorn
Joined: Nov 09, 2005
Posts: 12
posted
0
Hi Sriram TA
THanks for the reply.
Im storing the connections in one application variable, but this is not a good solution.
What I would like to know is how to use, for example, the connection pool of coreservlets in the right way, because Im using only partial.
Thanks Lu�s Matos
Lu�s Matos
Greenhorn
Joined: Nov 09, 2005
Posts: 12
posted
0
Hi
Anyone know or use the example that Im talking about?