Chapter 13: JDBC Connectivity Database connections pool manager
Chapter 13: JDBC Connectivity Database connections pool manager Web application Physical databaseconnections in pool 1. Request connection 3. Close logical connection 2. Receive logical connection RDBMS 4. Physical connection (returned to the pool) Figure 13-2: JDBC connection pooling A pool manager creates the initial physical connections, manages the distribution of the physical connections to the Web applications in the form of a logical connection, returns any closed logical connection to the pool, and handles any exception or error that may arise potentially disconnecting the physical connection or recovering from error conditions. Note that closing a logical connection does not actually close any physical connection, but merely returns the connection back to the pool. This pool manager functionality may be provided by one of the following three sources: . An application server such as Tomcat 6 . A third-party pool manager software vendor . The JDBC driver vendor When configuring Web applications to run on Tomcat 6, the preferred and recommended pool manager to use is one that is supplied with the Tomcat server. A Problem with Connection Pooling Since the introduction of JDBC 3 and application server connections pooling in general, Tomcat users have gained some experience in the use of connection pools. Over time, connection pools can sometimes develop problems. Since database connections are made over the network, they are not 100 percent reliable. Connections can sometimes fail in a way that you cannot recover from. Over time, since connections in a pool are kept open physically, many connections in the pool may start to go bad. The bad connections still hold up resources, and appear to be working to the pool manager. With JDBC 3 pooling, there is no reliable way of asking the connections if they are still valid. As a result, sometimes all connections in the pool need to be flushed, requiring a server restart.
For high quality java hosting services please check java web hosting website.