Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Tomcat 5.0 Database Change

Posted on 2010-11-23
7
Medium Priority
?
402 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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 http://domain.com (http://domain.com) 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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

609 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