This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Can I Pool Connections to DB Across JSPs?  RSS feed

 
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to pool connections to the database, to save time/resources. However, I was not sure of the context/life-cycle of a JSP, especially relative to other JSPs. Would this even work? Is it really possible to pool them across JSPs/Servlets? How would I go about doing this? Thanks!
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you store the connection pool in the application context then it will be available to all Servlets/JSPs in the application.
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply!
By application context, I assume you mean Servlet Context?
Also, to be sure I understand: I save the Connection Pool Handling Object, not the connections themselves there, right?
Thanks!
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the structure of the pool class usually contains a property, e.g. a collection object, for the connections to be managed. so if a connection pool handling object of this type is saved in the servlet/application context, in a way, the connection objects it contains are also stored into that context.
these connection objects will still have to be accessed though via the pool object in that context.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Robert Paris:
Thanks for the reply!
By application context, I assume you mean Servlet Context?
Also, to be sure I understand: I save the Connection Pool Handling Object, not the connections themselves there, right?
Thanks!


You are correct on both counts.
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!