• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I Pool Connections to DB Across JSPs?  RSS feed

 
Robert Paris
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!
 
Matthew Phillips
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!
 
boyet silverio
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!