This week's book giveaway is in the Java in General forum. We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line! See this thread for details.
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???
posted 15 years ago
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