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

2.0 connection pooling and other methodologies

anand raman
Ranch Hand

Joined: Jun 06, 2001
Posts: 66
hi guys
I wish to understand the difference between connection pooling as specified in JDBC 2.0 optional package and other implementations.
I wish to know why would any JDBC developer wish to implement ConnectionPoolDataSource and PooledConnection when connection pooling can be easily implemented using other methodologies (like store in a ArrayList) e.g DbConnectionBroker from javaexchange.com
What distinct advantages does the JDBC 2.0 acheive.
Thanks
Anand
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by anand raman:
I wish to know why would any JDBC developer wish to implement ConnectionPoolDataSource and PooledConnection when connection pooling can be easily implemented using other methodologies (like store in a ArrayList) e.g DbConnectionBroker from javaexchange.com

First off, you as a JDBC developer will not implement these interfaces any more than you implement Connection or Statement. They are supplied by the JDBC 2.0 driver and you just use them.
One of the most important advantages over any other solution is that they are part of the JDBC API and thereby standardised. Instead of being stuck with a single connection pool implementation, you can choose any driver which implements these interfaces. When you use an application server, you no longer have to supply your own connection pool in order to achieve portability, but can just use the server-provided one.
Another advantage is that, since the pool is part of the JDBC driver, it may be faster and/or more reliable. A good connection pool will ensure that the connections it hands out are fully functional (which is why a vanilla ArrayList is not a good idea). A driver has low-level access to the database and may have ways to test connections that simply aren't available to a JDBC connection pool.
Personally, I also like the fact that you don't have to remember any special syntax to return connections to the pool.
- Peter

[This message has been edited by Peter den Haan (edited June 08, 2001).]
 
jQuery in Action, 2nd edition
 
subject: 2.0 connection pooling and other methodologies