Fellow ranchers, I am trying to decide which way is cleaner(I.e. easier to maintain and less error prone) for obtaining User and Password values for create a database connections. 1.) Use ServletInitParameters(web.xml or default_app.webapp(I use Websphere) to store the User/Pass values....Thanks Mana Anna 2.) Use a db.properties file to store the User/Pass and use a Properties object to obtain User/Pass Both have their drawbacks. I can only use the ServletInitParameters for Servlets(JSP). For Properties file I have the properties file in my classpath. I am leaning towards the properties file approach. I'd appreciate any comments however.
You can also comment the deployment descriptors The cleanest way of all is to use the database provider from the application server through JNDI (if the appserver supports this, of course). Something like:
That way the servlet does not need to bother with database connections at all and will use connection pooling automatically if provided by the appserver. [This message has been edited by Jeroen Wenting (edited April 23, 2001).]