Some operations are verrrryyyy slow. Database connections are the usual culprit. Consider an application where you have a buch of short database operation scattered through your application, like 'check user exists', 'get user groups', 'load preferences', 'update list of things', 'check other list for updates' and about a hundred more.
You would find that the cost of opening and closing database connections took significantly more time than the actual operations. You may consider solutions like using a single connection in yourr application, or maintaining a connection for a user, but these solutions, while sounding useful, have serious problems of their own.
The solution is to get an intermediate layer to open a bunch of connections and share them with anyone who wants to use them. Database connections are nice since you can almost always reuse them. Connection Pools, a specific type of Resource Broker, can also manage a bunch of other things under the covers for you so you don't have to worry about them.
But enough about Connection Pooling in the servlets forum, I'll move this thread to the JDBC forum for you.
Joined: Sep 16, 2005
JDBC connection pooling related with the performace of server and your webapplication that why we use the connection pooling . Actualy in connection pooling we gave connecton to database with server and to application we gave refrence of server . So same connection can be give in no.of application so performace increase.
Joined: May 09, 2002
David have explained it very well.
My friends and I have a connection pooling class of our beloved teacher mr. waheed from our java learning days that we love to use. I can post it if I am allowed.
Maki, In general, the question of posting other people's code depends on two criteria: 1) Did you give them credit? - This you already did. 2) Is the other person ok with it? - Not sure if how the original author would feel on this one.
In any case, the Conmmon's link Ben provided is very good. I highly recommend that over a custom implementation.