Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection Pooling - Passing your pool to the application

 
Bobby Cunningham
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
***** 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. . .
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15288
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).

The Tomcat documentation explains in detail how to do this:
JNDI Datasource HOW-TO
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic