This is a discussion on Tomcat 4.1.24 configuration settings within the Apache Web Server forums, part of the Web Server and Related Forums category; I am trying to write a Java-based web application. I am using Tomcat 4.1.24 as my servlet/...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am trying to write a Java-based web application. I am
using Tomcat 4.1.24 as my servlet/JSP engine. The application uses MySQL. My question is this: I want to use two databases, one for production, one for testing. I have two directories under the webapps directory, prod and test. I want the application to know which directory it is in and point to its respective database. Is there a way to do this using the directory name? Or should I read it out of a file, like web.xml? I have tried to parse my own XML file, but the application will only read out of the $CATALINA_HOME\bin directory. I can't seem to get it to read a file from the home directory of the application. I haven't tried using JNDI or DataSources yet because it looks like they use the server.xml file. If I used that I think I would still have a problem of not being able to decide which entry to use. I currently have only one version of Tomcat running. Do I need to run another Tomcat instance to make this work? If so, how does the application know which version of Tomcat to use? Thank you in advance for your assistance. - Paul Ackerman pgackerman@email.com |
|
|||
|
In alt.apache.configuration Paul Ackerman <pgackerman@email.com> wrote:
> its respective database. Is there a way to do this using > the directory name? Or should I read it out of a file, like > web.xml? You'd better put the database connection url in some kind of configuration file and then refer to that in the code. This way no matter the name of the directory and you can easily change the database later. See the documentation for the Servlet package and the Properties class. Davide |