1

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.

Uppi
  • 702
  • 2
  • 13
  • 37
  • Just to clarify, is the connection managed by the tomcat server itself (which is mapped to a name like "jdbc/myDB") and looked up by the web application using that name or does the web application open the connection itself? If it is managed by the server, can you not just set up the staging server's connection differently? – BretC Apr 13 '15 at 20:42
  • It is managed by the server in context.xml driverClassName="oracle.jdbc.OracleDriver" name="jdbc/XApooled" . This specific webservice is used by a reporting tool. The war is deployed in the Tomcat development. We need the same war pointing to the staging business objects reporting URL with the staging database. – Uppi Apr 13 '15 at 20:51
  • Not sure how to make the same war file available for staging environment with the staging database? – Uppi Apr 13 '15 at 21:05

1 Answers1

3

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.

slambeth
  • 887
  • 5
  • 17