Connection Pooling - Passing your pool to the application
posted 10 years ago
***** My environment ***** JDK - 1.5 App Server - Tomcat 5.5 Database - Sysbase Framework - Struts
***** My question ***** When my application starts we kickoff a Startup Servlet that extends HttpServlet. In this servlet I initialize the DB Pool with a min of 5 connections. This creates a pool that stores the connections. So the only use of our servlet is to init the application.
How do you pass the pool object to the rest of the application? What is the best way to handle this? Please help. . .
Usually, you configure the connection pool in Tomcat (in one of the XML configuration files). Tomcat will register the pool in JNDI, and you'll use JNDI in your application to lookup the pool (in the form of a DataSource object).