File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC 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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Dynamic IP address for thin driver" Watch "Dynamic IP address for thin driver" New topic
Author

Dynamic IP address for thin driver

Manu Syal
Greenhorn

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:@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???
Shripad Bokil
Greenhorn

Joined: Jan 30, 2001
Posts: 13
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

 
wood burning stoves
 
subject: Dynamic IP address for thin driver