Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connection in ContextAttribute

 
heidi_psl
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Chintan Rajyaguru
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nikhil Goel
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic