Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help regarding ip address used in establishing connection using jdbc

 
bagaria kushal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it is a web application then you can use datasource managed by your application server.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic