wood burning stoves 2.0*
The moose likes JDBC and the fly likes What is Connection Pooling? And how to use It Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "What is Connection Pooling? And how to use It" Watch "What is Connection Pooling? And how to use It" New topic
Author

What is Connection Pooling? And how to use It

Ahmed Shaikh
Ranch Hand

Joined: Jul 25, 2005
Posts: 51
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Sep 16, 2005
Posts: 10
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.


123
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 435
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


Help gets you when you need it!
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30075
    
149

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What is Connection Pooling? And how to use It
 
Similar Threads
Questions on EJB
Connection pooling...?
connection pooling
Connection pooling
connection pooling in struts