aspose file tools*
The moose likes Servlets and the fly likes connection in ContextAttribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "connection in ContextAttribute" Watch "connection in ContextAttribute" New topic
Author

connection in ContextAttribute

heidi_psl
Greenhorn

Joined: Jun 22, 2006
Posts: 8
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61227
    
  66

"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.

I've moved this topic there.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61227
    
  66

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.

bear
JavaRanch Sheriff
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by heidi psl:
Is it a good practice to do that.


No.
Search this forum with keywords "connection pooling" and you will find many, lengthy, drawn out discussions on the subject.


And,....
Please fix your name so you can remain with us.
[ June 24, 2006: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Chintan Rajyaguru
Ranch Hand

Joined: Aug 19, 2001
Posts: 341
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.


ChintanRajyaguru.com
SOADevelopment.com - Coming soon!
Nikhil Goel
Ranch Hand

Joined: Jul 11, 2003
Posts: 32
heidi

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 .

thnks
Nikhil
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connection in ContextAttribute