You should not locate your connection pool in a servlet. In general, you
should avoid trying to make method calls from one servlet to another. The
problem is, you do not have control over how the servlet container loads or
unloads copies of servlets. You can check out the connection pooling part of
the Expresso web application framework at www.javacorporate.com to get some
ideas (it is open source).
- Adam
----- Original Message -----
From: "Vikas Gupta" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 28, 2000 10:51 AM
Subject: Connection pooling in servlet
> Hi all,
>
> i have made a connection pool servlet for holding a set of
connections.This
> servlet is loaded before any other servlet runs.
> i am creating a pool of say 10 connections which are placed in a Vector in
> the connection pool servlet.
> Then in each of my servlets , in the doGet() (Assuming i have only doGet()
> and no doPost() ) i am calling the getConnection() method of the
> ConnectionPool servlet which returns the first free Connection in the
> Vector.
> Next after processing the database transactions i am closing the
connection
> i.e. i am putting the connection which was obtained in the beginning of
> doGet() back into the pool and setting the Use flag to false for that
> particular connection so that other requests can get this freed
connection.I
> am doing this at the end of doGet();
> Is there any problem if i call another servlet from my present
> servlet??Because then i will be getting another , perhaps a different
> connection from the pool in the called servlet????
> Even in the same servlet i may get a different connection for
> different GET requests for the same user . Right.
> Or am i wrong somewhere ??Any suggestion!!!
> I am doing this for the first time.So i am not familiar with the problems
i
> could face.
> Can anybody foresee any problem.
> Your help would be highly appreciated.
> Thanks.
>
>
___________________________________________________________________________
> 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