I've tried the solution of overriding the construction method and it seems
working. Overriding init() sounds more reasonable since the construction
method of Servlet does nothing. But what is the difference between the 2
solutions? Even for overriding init(), how to inform the client in case of
DB connection failure?

Thank you.

-----Original Message-----
������: Vishal Salian <[EMAIL PROTECTED]>
�ռ���: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
����: 2000��5��22�� 14:16
����: Re: Servlet with JDBC


>Try giving the Class.forName() in the init method of the servlet .This will
>create only one instance.
>Regards,
>
>Vishal
>
>
>>From: Xu Jianwu <[EMAIL PROTECTED]>
>>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>>        Servlet API Technology." <[EMAIL PROTECTED]>
>>To: [EMAIL PROTECTED]
>>Subject: Servlet with JDBC
>>Date: Mon, 22 May 2000 13:23:34 +0800
>>
>>I am developing servlets with JDBC API to access my database. In order to
>>ensure that the database connection is created only once for the threads
of
>>a servlet, where or when should I Class.forName() and
>>DriveManager.getConnection()? Should I override the construction method of
>>(e.g.) HttpServlet and do them there?
>
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail 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

___________________________________________________________________________
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