aspose file tools*
The moose likes JDBC and the fly likes need help regarding ip address used in establishing connection using jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "need help regarding ip address used in establishing connection using jdbc" Watch "need help regarding ip address used in establishing connection using jdbc" New topic
Author

need help regarding ip address used in establishing connection using jdbc

bagaria kushal
Greenhorn

Joined: Mar 29, 2011
Posts: 19

Hi all,

I have an application in which i establish connection with database using jdbc. My problem is that whenever the database server's ip address gets changed, i have to go into the code and change the ip address. Is there any solution so that i can mention the ip address outside the code like in xml or something?
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

You can save the Db URI detail in either a .xml or .properties file and fetch it. That would make it more on the lines of 'configurable'. You will have to handle caching issues after modifying the value.
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
If it is a web application then you can use datasource managed by your application server.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help regarding ip address used in establishing connection using jdbc