Two Laptop Bag*
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
JavaRanch » Java Forums » Databases » JDBC
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.

jQuery in Action, 2nd edition
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