Hello, fellows,
As is the title, in a servlet
[1] may I obtain a DB connection from the pool in "init()"
and release it back to the pool in "destroy()" ?
For, I remember, when "connection pooling"
has not been so popular as today, there are samples
which create DB connections and even prepare statements
in "init()" and close them in "destroy()", in order to
improve its performance reportedly.
Or, while taking advantage of connection pooling,
[2] must I obtain and release a connection only
in a servlet's "doPost()" or "doGet()" ?
Someone explained that
if a connection is obtained in "init()", it will keep
occupied so never released until "destroy()".
So here what confuses me is
[3] when on earth "destroy()" is called ?
[4] What is the exact meaning of
"the end of a servlet's life cycle" ?
If there exist several requests for the same servlet
at the same time,
[5] is "init()" called only once ?
If a member variable ( not static )
is given a new value,
[6] will it be shared by
all the instances of the servlet
( like the case in [1] ) ?
Thank you for your help.
----------------------------------------
[EMAIL PROTECTED]
Office: Tokyo, Japan http://www.gecapital.com
Home: Dalian, Liaoning, China (Hometown: Hunan)
----------------------------------------
___________________________________________________________________________
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