ThisGuy
ThisGuy

Reputation: 51

Changing database connection string in a Java web application

I inherited a Java web application due to my expertise in .Net(I have no experience in Java). I need to change this:

http://**DatabaseOne**.Domain.com:Port/dir1/dir2

to this:

http://**DatabaseTwo**.Domain.com:Port/dir1/dir2

In .Net we have a Webconfig file where the connection strings are stored.
My research( Question 1 2 3 shows that there should be a Content.xml, Web.xml and/or Server.xml in a Java directory.

The Content and Web xmls that I have found, do not contain the connection strings I am looking for.

The DBManager.Java contains:

Public Connection getPoolConnection() throws JDBCConnectionException{
         return JDBCService.GetConnection("oracleUIPool");
 }

This Java web app seems to be a part of a larger Java web app, so the connection string must be somewhere at a higher level directory? What would be the name of this directory?

I did notice files named Beans, JetSpeed, and Struts, if that helps.

Upvotes: 2

Views: 2266

Answers (2)

user1352498
user1352498

Reputation:

Java works with the concept of a DataSource that could be managed by the server container: Tomcat, JBoss etc. Inside each server there's a lot of config files that could be used to configure the DataSorce. For each server and for each version there's configurations. The first step is know the server, the second is if the app is using a framework like Hibernate. Later, you will know the kind of configuration that you could use for it and, safely, you could find and change the URL.

Tomcat: http://blog.mangar.com.br/?p=57 JBoss: https://community.jboss.org/wiki/ConfigDataSources

Upvotes: 0

rapadura
rapadura

Reputation: 5300

Its in the application server configuration as a data source, check oracle-ds.xml or similar.

If you are using jboss, do a find . -iname '*ds*xml' or datasource and see if there is anything there. If you are using glassfish, check oraclePool settings using the web admin interface.

Upvotes: 1

Related Questions