• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is Connection Pooling? And how to use It

 
Ahmed Shaikh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All.
plz any one tell me some thing about connection Pooling.
please explain me with example..
waiting for reply.
Thanx in advance
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This page
http://jakarta.apache.org/commons/dbcp/
should answer your questions.

By the way: This is the library used by Tomcat for connection pooling.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Dave
 
Rajendra Pachouri
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maki Jav
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,

Maki Jav
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic