File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Dynamic IP address for thin driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Dynamic IP address for thin driver" Watch "Dynamic IP address for thin driver" New topic

Dynamic IP address for thin driver

Manu Syal

Joined: Nov 28, 2000
Posts: 4
I am using Oracle Thin driver to connect to Oracle database.
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver ());
con = DriverManager.getConnection
("jdbc racle:thin:@","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???
Shripad Bokil

Joined: Jan 30, 2001
Posts: 13
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
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 u dont have to compile your program at all.
Hope this will solve your problem.

I agree. Here's the link:
subject: Dynamic IP address for thin driver
It's not a secret anymore!