Tomcat 5.0 Database Change

Posted on 2010-11-23
Last Modified: 2012-08-14

I need to change my database connection.  My current configuration is:

<Host name="" appBase="webapps">
<Context path="" docBase="/home/www/" debug="1" reloadable="true" crossContext="false">
            <Resource name="jdbc/trampoline" auth="Container" type="javax.sql.DataSource" />
                    <ResourceParams name="jdbc/trampoline">



Can I simply change the line:


Or do I need to edit additional file?

Thank you! ~Wendi
Question by:FrostyGirl
LVL 27

Expert Comment

ID: 34199606
Yes, you can change the connection string to go to a different database.  Then all your code will go to the new database connection, and you will not be accessing the databaseA.

It's easy to try -- is there something else you're concerned about?  Or did you try it and it didn't work?

Author Comment

ID: 34200116
Tried it and it didn't work.

Author Comment

ID: 34200119
It's still using DB A
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

LVL 10

Expert Comment

ID: 34200527
It looks correct - make sure you have restarted the server.
LVL 27

Accepted Solution

mrcoffee365 earned 500 total points
ID: 34200853
After making sure that you have re-started your server --  changes to web.xml do not occur unless the webapp is reloaded -- then you need to post the exception you're getting.

If your code has the url for the database hard-coded somewhere, then it will use that regardless of what you write into this context parameter.  The parameters have to be used in the code -- nothing in the webapp makes any use of them.
LVL 13

Expert Comment

ID: 34201656
As mentioned above you need to restart the tomcat. First stop the tomcat using the script "" and start using the "" in your tomcat's bin directory.


Expert Comment

ID: 34321940
And make sure that the username and password are correct for databaseB :-)

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
spring example non maven 4 87
PHP Apache application gives "Forbidden" message 5 57
Why my table column Id is not passed to java object? 4 39
runtime exception 2 28
In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting ( to http…
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question