Hi ranchers!
I have made a class that implements the ServletContextListener. In this
servlet I make a Connection that I can use in my application. ( I put it in the Context.setAttribute() ).
My problem is that when I use this the Connection will be opened the whole time the application is alive. I want to make a Connection pool soo that I can close the connections after I have used them.
I'm not sure if I have to close them or what's the best approch when coding this. It is just that I've heard of Connection pooling but I don't know how to do it , why it is soo good etc.
I think by using it the way I have coded now that the Connection must finish before it can run a query again. If I have 500 users that want's to connect to the database then I have a big problem.
My question is.
* How do I code a Connection Pool ?
* What is a Connection Pool. ?
I've read that
you should use JNDI instead of DriverManager. Is this correct and why?
// Mathias