A new instance of the LoginBean will be created for each session.  It would
be more appropriate for you to maintain your connection pool in another
class, and for your LoginBean to ask that class object for a new connection.
You should also consider how best to manage the connection pool so that it
appropriately recovers from a server shutdown or the like.

Another, simpler, approach would be to have each LoginBean establish and
retain its own database connection.  The price of doing this is really only
going to be once, at login.  We looked at using connection pools, and for a
small number of connections it really didn't save us much on systems that
will not need to be scaled up.  In fact our DBAs said no to us even using
connection pools, and here they decide such things.  They didn't want a
bunch of open and unused connections sitting around.

Probably rubs all the connection pool purists out there a little bit the
wrong way, but hey!

Cheers,

Dan
--
Daniel Kirkdorffer
NACN IS: 425-580-6225
Sr. Consultant, Syllogistics LLC
Email: [EMAIL PROTECTED]
Web:   http://www.syllogistics.com/


> ----------
> From:         Nanduri Amarnath[SMTP:[EMAIL PROTECTED]]
> Reply To:     [EMAIL PROTECTED]
> Sent:         Wednesday, September 29, 1999 7:13 AM
> To:   [EMAIL PROTECTED]
> Subject:      Database Connections
>
> Hi everybody,
>      I am using a LoginBean as a Session Object in my JSP pages.   The
> LoginBean
> takes user info and connects to a Database (where it validates the
> username and
> password).  I am using a ConnectionPool to maintain a pool of connections
> to a
> Database.  I am creating the ConnectionPool inside the constructor of the
> LoginBean.
>
>      My question is... If some 10 clients use my app.. will 10
> ConnectionPools
> be created ? If so, how can i overcome this to maintain only a single
> connection
> pool and have all my LoginBeans (sessions) access that pool.
>
> Forgive me if i am wrong...but i was under the impression that only a
> single
> LoginBean will be created on the server and all the JSP requests access
> that
> bean. If this is the case, then how can i maintain sessions for all the
> different users ?
>
>
> In servlets i used the  init() method to create my ConnectionPool. Is
> there
> anything like this method, that i can use in the JSP to create my
> ConnectionPool
> ?
>
> Thank you very much for your feedback.
>
> Cheers,
> Amar..
>
> [EMAIL PROTECTED]
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to