wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic IP address for thin driver
 
Similar Threads
WAS 5.0 and Oracle 9i JNDI lookup problem
Getting ClassCastExceptions with CachedRowSet
WSAD Connectivity to remote Oracle 8i db for enity ejb mapping
MDB calls EJB requires new transaction
JDBC Driver for Oracle RDB