This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!