Hi Jothi,
Using the <param-name> <param-value> in the DD, you can set the DB URL, user name and password which you can retrieve in the ServletContext using getInitParameter(). You can get only
String and NOT Objects using parameter. Also you cannot set the parameters programmatically. You can set an object as an attribute.
For your scenario, you can create a connection object in the contextInitialized() method, getting the context parameters and set the connection object as attribute in the ServletContext. Since ServletContext is available for the whole application, you can get the connection object using the getAttribute() method.
Hope this will clear your doubt.