HI Chris

Could you please elaborate a bit on this. I was/am under the impression that
since init() is going to get called only once in a servlets life time anything
we write in that is going to be thread safe. But your mails seems to say that it
is/may not be so always.
Also what does ' the diff types of JDBC implementations'  mean. Here again I am
under the impression that JDBC since it is provided by sun it has to be same
only we need diff drivers to connect to diff databases.
Please throw some light on this

Thanks

Nitin




Chris Gow wrote:

> Hi:
>
> Although it will save time during the servlet's request method is run and
> will cut down on system resources (one connection for all requests).
> Creating the connection in the init method is *not* always thread-safe.
> Alot of JDBC implementations allow for multiple statements to be created
> (sharing a connection over a thread) but not all do.  A safer approach would
> be to create a pool of connections at start up and have each request access
> a connection from the pool, possibly blocking if no connection is availible
> or returning a page notifying the user that the system is busy and should
> try again in a few minutes.
>
> I know I have had problems in the past when I was using one connection
> between multiple threads.
>
> Chris Gow
> [EMAIL PROTECTED]
>
> > -----Original Message-----
> > From: Cote, Stephane [SMTP:[EMAIL PROTECTED]]
> > Sent: Wednesday, August 04, 1999 7:26 PM
> > To:   [EMAIL PROTECTED]
> > Subject:      Thread safe JDBC connection
> >
> >
> >
> > Hi all.
> >
> >         Is loading a JDBC driver and making a connection in the servlets
> > init() method a good practice from thread safety when concurrent instances
> > of the servlet are created.
> >
> > Stef
> >
>
> ___________________________________________________________________________
> 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