Well, this is a bit of a vague question, so let me try to answer what I
think you are asking. If you are asking whether you should open a
connection to the oracle database in your init and then use that
connection with your servlet, the answer is no. Database access should
be done through a connection pool. There are several of them floating
around if you check the archives and you can get Jason Hunter's book or
the O'Reily book and get some good examples. You should use the init to
initialize any class variables that you are going to use. For example,
my servlet reads in a configuration file when it comes up. I do this in
the init.

Before building your servlet, sit down and design it on paper. Servlets
are really helped from a detail design starting off.

Doug Bridges


>From: Sam Rose <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's
JavaServlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: To init or not to init
>Date: Wed, 10 Mar 1999 11:02:03 -0000
>
>Hi,
>
>I was wondering which approach would be best for my servlet's that I
>am currently developing.
>All of the servlets connect to an Oracle database.
>
>I was wondering do I need to use an init() and destroy() in my coding,
>can I leave this out or would that be a bad idea? As couldn't I just
>use finally clause, or have I lost the plot altogether?
>
>Sam Rose
>
>___________________________________________________________________________
>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
>

Get Your Private, Free Email at http://www.hotmail.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

Reply via email to