Howdy Fellow ranchers, I have a question for you all. I am would like to create a connection to a database without having to hardcode the user/pass in the connection code or having to read a properties files to obtain it. Any there any other ways that I could do this so that the code is clean, the user/pass can be changed without impacting connection code and without having to keep track of a properties file?
If you are using servlets, you can have the user and password as part of the initial parameters and then just get them with ServletConfig. Or you can have your basic get and set methods so your other classes and set the username and password with them. Also a constructor to set them would work. Bill
Edit ....\WEB-INF\web.xml file and include your init params. If you change those params in web.xml file after loading your servet engine, the new changes will not come into effect. One time init only. A related discussion : http://www.javaranch.com/ubb/Forum7/HTML/001790.html regds maha anna
[This message has been edited by maha anna (edited April 20, 2001).]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Obtaining User/Password info for DB connections