There are at least two places where I can think of doing that:

1. Since the pool is conceptually a singleton (one instance for
the entire application) then it may make sense to have a static
reference to it from DBHandle.

2. Another option might be to keep a reference in the application
level (via ServletContext.setAttribute()/ServletContext.getAttribute())

Make sure that the pool is indeed initialized before it is used for
the first time, either automatically configure upon first access or
maybe via an init() method of one of the servlets which is configured
to "load on startup".

Hope this helps,

--Amos Shapira
WebCollage

> -----Original Message-----
> From: Srini Sathya. [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 21, 2000 2:41 PM
> To: [EMAIL PROTECTED]
> Subject: JSP-Servlet-DB
>
>
> Hi,
>
> We are designing our application as follows:
>
> JSP -> Servlet [to retrieve the form data] -> DBHandle [For hadling
> dbrequest ].
>
> Once the user submits the form it will call a servlet which
> will have all
> the form data.  My problem is that i need to maintain a CP
> and to give one
> connection for each and every request to the DBHandle which
> will update the
> database.  If my servlet is going to be only one then i would
> have my CP
> initialized at the init() and can manipulate my poool, since
> i have lot of
> servlets (one for adding user, one for adding a group etc.,)
> i am confused
> where to create the pool.  I fear if i create the pool in the
> DBHandle class
> then since each and every servlet is going to create a
> instance of DBHandle
> there would be lot of connections, is that correct??.  If
> this is a bad
> design where would be the best place to instantiante my CP
> and to create
> pool.
>
> Thanks for ur help,
> Srini
>
> -----Original Message-----
> From: Khurram Saqlain [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 21, 2000 1:53 AM
> To: [EMAIL PROTECTED]
> Subject: application design
>
>
> I'm designing our application which looks like:
>
> JSP/HTML          (presentation layer)
> -----------
> Servlets          (Application layer)
> ----------
> EJB               (DB Layer)
>
>
> My question, how should I pass data retrieved from the database
> as a EJB to the JSP layer? I could pass the EJB to the presentation
> layer but is there a another alternative?
>
> Is passing an EJB to the presentation layer a good approach
> when the result set contains a large number of rows?
>
> TIA,
> Khurram
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to