Connection pools

Database connections : The last point is critical: connections must always be properly released when no longer needed. Failure to do so will eventually cause the application to "hang", and fail to respond to user actions. All code in your application regarding connections should be treated with special care.

To ensure that database connections are used as efficiently as possible, many applications make use of a connection pool, which can sometimes dramatically improve performance in a distributed application. An application will use a connection pool as follows :

A database driver may contain a connection pool as part of its services, through its implementation of the javax.sql.DataSource interface. DataSource objects are used with JNDI.

The popular Tomcat tool implements JNDI, and connection pooling is described in its documentation. It is not difficult to use.

See Also :
Get database connection
Encapsulate connections
Would you use this technique?
Yes   No   Undecided   
© 2010 Hirondelle Systems | Source Code | Contact | License | Quotes | RSS
Individual code snippets can be used under this BSD license - Last updated on June 5, 2010.
Over 150,000 unique IPs last month - Built with WEB4J.
- In Memoriam : Bill Dirani -