Well I'm kind of "fresh" in this area but I thought you might think this as
usefull:
Create a ConnectionPool (as a single tone)by this you ensure that you can
controll both the amount and the synchronization and then in each servlet
call the getInstance method(of the single tone)in the doGet() or doPost() to
get a connection and in the end return the connection.

 I hope I was helping .
Would love to hear your opinion.
 Ron Peled

-----Original Message-----
From: Geeta Ramani [mailto:[EMAIL PROTECTED]]
Sent: Tue, May 01, 2001 1:55 PM
To: [EMAIL PROTECTED]
Subject: Re: Session & Database connection


Well, ok, I guess you mean *explicitly* calling the init() in the code as
opposed to automatically/implicitly calling it when the servlet is
initialized.. I stand corrected. But I think the initial poster may still
not
want to declare/create a connection object in the init() method *unless* he
means to share it amongst all requests.. I think i am right in this. As
another
poster (Pierre-Yves) said, the best thing would be to create the pool in the
init(), and then create and release connection within the doGet()/doPost.
This
will ensure both that each request receives its own connection object and
that
things are reasonably fast. (I was not thinking straight when I said the
connection object should be stored in a session variable.. long Monday with
meeting after meeting after.....(;-)..)

Geeta

"Christopher K. St. John" wrote:

> Geeta Ramani wrote:
> >
> > Since code in the init() method is executed *exactly* once at
> > servlet initialization time (*not* once per request)
> > ...
> > Instead you want to initialize the ConnectionPool in the init
> > method ...
> >
>
>  A servlet's init() method can get called lots of times, as
> long as there is a destroy() in between. It's actually legal
> (although a little silly) for the container to call init(),
> service(), destroy() on every single request, so you'e got
> to make sure to release the connection pool in the servlet's
> destroy() method.
>
> --
> Christopher St. John [EMAIL PROTECTED]
> DistribuTopia http://www.distributopia.com
>
>
___________________________________________________________________________
> 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