iam getting connection to DB in Listener class and setting it as a Context Attribute.this class is called when deploying the application. i am not using connection pooling. thic connection obj iam using in alll jsp's & Servlets. Is it a good practice to do that.
"heidi psl", please take the time to choose the appropriate forum for you questions. 4 out of 5 of your previous posts had to be moved to different forums, This is clearly a Servlets question and should be asked in the Servlets forum.
Also, you have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.
Be aware that accounts with invalid display names are removed.
Well, the question should be why aren't you using connection pooling? Most database driver implementations support it. You can define a data source for your web application and use it for database interaction.
you need to use Connection pooling reason being in a web based application you can have n number of users accessing the app hence context is not a nice idea. Context in any application servers, applications are used for the properties,values that remain same through out the life of an application and also applications interact with servers through context .