GlobalResources sounds like what I am looking for. According this page ( http://tomcat.apache.org/tomcat-6.0-doc/config/globalresources.html) it seems like I need to just add the following configuration in server.xml:
<GlobalNamingResources ...> ... <Resource name="jdbc/EmployeeDB" auth="Container" type="javax.sql.DataSource" description="Employees Database for HR Applications"/> ... </GlobalNamingResources> If I understand correctly, this will make jdbc/EmployeeDB JNDI resource available to every web application deployed in the container, correct? Will it override the JNDI resource definition packaged in META-INF/context.xml inside of the WAR file? Thanks! On Tue, Sep 14, 2010 at 3:58 PM, Pid <p...@pidster.com> wrote: > On 14/09/2010 22:52, Alec Swan wrote: > > Hi Chris, > > > > Thank you for the defaultHost recommendation. > > > > The deployment scenario I would like to support requires deploying the > same > > WAR file on the development server first and then on the production > server. > > Development and production servers use different database credentials, so > I > > cannot package them in the WAR file itself. So, the database credentials > > should be stored somewhere in the server configuration. > > > > What is the recommended way to support this scenario? Is there any other > > place besides conf/context.xml where I can store server-specific DB > > credentials? > > You're not defining the DB Resource in GlobalResources? > > > p > > > Thanks, > > > > Alec > > > > On Tue, Sep 14, 2010 at 3:18 PM, Christopher Schultz < > > ch...@christopherschultz.net> wrote: > > > > Alec, > > > > On 9/14/2010 5:04 PM, Alec Swan wrote: > >>>> I have a WAR file which I distribute to multiple servers with multiple > >>>> virtual hosts. On each server I have a database, which is accessed by > all > >>>> virtual host apps on this server. > > > > I'm interested: is the WAR actually identical, including all settings > > for all virtual hosts? If so, you can save yourself a lot of memory and > > database connections by deploying a single copy to a single <Host> and > > either setting that host as the "defaultHost" for the <Service> or using > > <Aliases> within the <Host>. > > > >>>> Is it the right approach to put database access credentials in > >>>> $TOMCAT/conf/context.xml > > > > No. You shouldn't really modify conf/context.xml unless you have a > > really really good reason to do so. > > > >>>> which will then be loaded by each virtual host app > >>>> or should I put them somewhere else? > > > > Put the <Resource> for your database connection pool into your webapp's > > META-INF/context.xml file. > > > > -chris > >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >> > >> > >