Connection Pool

With connection pools servlets acquire connetions to databases from a pool and returns the connection back to the pool for later reuse. Because the connection is opened only at the first request there is no overhead with opening and closing connection every time. The servlet creates the pool in its 'init' method. This method is executed only when the servlet is loaded. After a timeout period the connection pool closes expired connections.

Connection pools are an efficient way of handling database connections with servlets.

Examples:

jdbcexample.java

This program is provided for demonstration purpose only. It can be the starting point to develop more sophisticated applications.

ConnectionPoolObject.java