• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamic IP address for thin driver

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Oracle Thin driver to connect to Oracle database.
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver ());
con = DriverManager.getConnection
("jdbc racle:thin:@192.168.1.174:1521:resume","scott","tiger");
The application I am making is goign to be a product , and as such the Oracle server IP address will be changing as well as user name and password.
So what should I do to avoid this as otherwise I have to compile my servlet everytime the server IP address is changing???
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
One solution for this problem is to use a properties file.
Create one simple text file like....
ipaddress = //the address
Seve it with " .properties" extension
& use java.util.ResourceBundle to access this ipaddress.
write these lines in your code ....like....
ResourseBundle r = ResourseBundle.getBundle("propertyfilename");
This will solve your problem...i.e whenever u want to connect to any server/machine...just change the respective address in properties file...so u dont have to compile your program at all.
Hope this will solve your problem.
Shripad

 
I am displeased. You are no longer allowed to read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic