Dynamically Obtaining Username and Password

Hi,

I am using Oracle Application Server and implementing a Servlet in it.

The issue I am having is , how do I dynamically get the username and password to connect to the database? Should I use a configuration file and hard code it? Is there any specific file I can read from?

Besides, there are other properties such as the Server name, DB name etc which I would like to read. There is an XML properties file. Is there a text version for it?

Please let me know.

Thanks in advance.

Menon

[530 byte] By [rvmenona] at [2007-10-2 18:42:22]
# 1
Hi,Generally used strategy is property file. This is the best way to keep information which is required at run time n cheges frequesntly.HTH?Gaurav
gauravda at 2007-7-13 20:04:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thanks but I still have the following doubts1. So do I have to hardcode the username and password?2. Is there a text version of the XML properties file.Regards,Menon
rvmenona at 2007-7-13 20:04:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Hi,

According to the previous reply , keeping username and password on properties file is a good strategy.

you dont need to hardcode anything inside your servlet or jsp.

Properties file is an ordinary text file . you dont need to confuse withe urself.

or else

you can register your database with ur web server.

To implement that , you need to do some work with web.xml. Please refer

documentation of your web server for more information.

thanks,

nvseenu

nsrininasa at 2007-7-13 20:04:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...