aspose file tools*
The moose likes JDBC and the fly likes why should i use connection pooling ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "why should i use connection pooling ?" Watch "why should i use connection pooling ?" New topic
Author

why should i use connection pooling ?

Aamir Iqbal
Greenhorn

Joined: Nov 29, 2002
Posts: 17
hi,
plz tell me, what is connection pooling and why should i use connection pooling in my application . i can make several connection using jdbc or thin line driver with database.
i have studied connection pooling but i am still confused.
plz help me
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The biggest performance problem when dealing with remote databases is the time taken to establish a connection.
In the case of very short operations like selecting a single attribute from a single row, the connection time might be orders of magnitude longer, such as a fraction of a second for the operation, but over a second to connect.
Connection Pooling gets rid of this by establishing connections before they are required and holding them until someone asks for one.
Other advantages to Connection Pooling are:
*it can reuse connections if they are returned, reducing work on the database to keep creating connections,
* they can be made to expand and contract as more connections are needed, which protects database resources from being wasted,
* and it can also have an upper limit of connections, to protect too many connections from choking the database.
Dave
Aamir Iqbal
Greenhorn

Joined: Nov 29, 2002
Posts: 17
Thanx dave,
but there is one thing more, I have made html reports for online reporting. and made connection many times in that report and delete that connection.
do u think, it is not good way ? if yes, than plz guide me how should i do this , and plz give me any third party tool for reporting in intranet based environment.
thanx
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

You can probably improve your code by reusing the Connection in the same page rather than opening and closing several Connections.
If you want a Connection Pool to use, this Google search returned several possibilities, including jdbcpool
Dave
 
 
subject: why should i use connection pooling ?