Uppi
Uppi

Reputation: 722

How can I make a war pointing different database in context.xml

We have tomcat instance running in the development server and pointing towards the development database. We have a context.xml which has the connection pointing to the database. Unfortunately, we dont have the staging servers available. So we might have to use the same war file to connect the staging database for the staging environment. How can we do it? Please help

The Web server is Tomcat.

Upvotes: 1

Views: 1283

Answers (1)

slambeth
slambeth

Reputation: 897

Rather than put your connection details in META-INF/context.xml, put them in the tomcat server configuration [tomcat]/conf/server.xml

This way the host determines what connection you utilize, not the war file, and you can deploy the same war file to every instance and know it'll connect to the proper database.

Upvotes: 3

Related Questions