• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Database connection pooling in tomcat

 
Greenhorn
Posts: 20
Android Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I want to use Database connection pooling in my web application.
I am using tomcat 5.5
In case of war file deployment, can we avoid editing server.xml ?
Is there any other way to configure the datasource resource in deployment descriptor (web.xml) itself.

Thanks
Rajul konkar
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can ship a context.xml file that sets up the data source as part of the war file. See http://tomcat.apache.org/tomcat-6.0-doc/config/context.html for details on how to do that. Obviously, this will only work on Tomcat, as it is not part of the Servlet specification.
 
Saloon Keeper
Posts: 24568
168
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could add a database connection pooling component to the webapp itself. But that's not common, because it limits you in a number of ways. More often, webapps use a container-supplied connection pool, which they locate using JNDI services. The web.xml file defines the JDNI pool characteristics which are matched to a server-provided connection pool.

Actually defining a server-provided connection pool requires configuring the server. You can do this by editing server.xml, or you can do this in Tomcat by providing an application context and defining a pool (or pools) for just that one application. As Lester said, you can provide this Tomcat-specific configuration information in your WAR in the resource named META-INF/context.xml. Or, you can define a context file and place it in the TOMCAT_HOME/conf/Catalina/localhost directory.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic