Solved

Tomcat 5.0 Database Change

Posted on 2010-11-23
7
399 Views
Last Modified: 2012-08-14
Hi,

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

<Host name="www.website.com" appBase="webapps">
        <Alias>*.www.website.com</Alias>
        <Alias>website.com</Alias>
<Context path="" docBase="/home/www/www.website.com/web" debug="1" reloadable="true" crossContext="false">
            <Resource name="jdbc/trampoline" auth="Container" type="javax.sql.DataSource" />
                    <ResourceParams name="jdbc/trampoline">
                    <parameter>
                            <name>factory</name>
                            <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                    </parameter>
                    <parameter>
                            <name>maxActive</name>
                            <value>100</value>
                    </parameter>
                    <parameter>
                            <name>maxIdle</name>
                            <value>30</value>
                    </parameter>
                    <parameter>
                            <name>maxWait</name>
                            <value>10000</value>
                    </parameter>
                    <parameter>
                            <name>username</name>
                            <value>invoke</value>
                    </parameter>
                    <parameter>
                            <name>password</name>
                            <value>$12_o</value>
                    </parameter>

                    <parameter>
                            <name>driverClassName</name>
                            <value>com.mysql.jdbc.Driver</value>
                    </parameter>
                    <parameter>
                            <name>url</name>
                            <value>jdbc:mysql://localhost:3306/databaseA?autoReconnect=true</value>
                    </parameter>

                    </ResourceParams>
        </Context>
</Host>


Can I simply change the line:
<value>jdbc:mysql://localhost:3306/databaseA?autoReconnect=true</value>

to:
<value>jdbc:mysql://localhost:3306/databaseB?autoReconnect=true</value>

Or do I need to edit additional file?

Thank you! ~Wendi
0
Comment
Question by:FrostyGirl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 27

Expert Comment

by:mrcoffee365
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?
0
 

Author Comment

by:FrostyGirl
ID: 34200116
Tried it and it didn't work.
0
 

Author Comment

by:FrostyGirl
ID: 34200119
It's still using DB A
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 10

Expert Comment

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

Accepted Solution

by:
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.
0
 
LVL 13

Expert Comment

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

Cheers!
0
 
LVL 3

Expert Comment

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

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 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