I have had success using a global Connection Manager.
See
http://www.servlets.net/support/downloads/samplecode/dbpooling/index.html
Frank
----- Original Message -----
From: "Geeta Ramani" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 12, 2002 3:53 PM
Subject: Re: connection reset by peer, system slow down
> Hi there: i think your problem is right there: you should not define your
> connection object as an instance vaiable. Since servlets are not
inherantly
> thread safe, this means that if multiple users access your servlet
> simultaneously, you will run into trouble (unless you synchronize access
to the
> connection object). You can test this theory out by declaring and
initialising
> your connection in the doGet/dopost methods. You will not then have
problems
> with simultaneous access.. Of course the best soultion is to declare a
> connection pool as an instance variable in your servlet, initialise it in
the
> init method and then pick up connections and release them as you need them
> within your doGet/doPost methods.
>
> Hope this helps,
> Geeta
>
> bin cai wrote:
>
> > Hi, Samuel,
> > thanks first.
> > I define connection as instance variable and create
> > connection in the init method like:
> >
> > public synchronized void init (ServletConfig config)
> > throws ServletException {
> > try {
> > super.init();
> > } catch(Exception ex) {
> > System.out.println(ex.getMessage());
> > }
> >
> > // establish connection
> > try{
> > conn = getConnected();
> > } catch(Exception ex) {
> > System.out.println(ex.getMessage());
> >
> > as i know the connection will closed automatically
> > when servlet is unload or stoped. so in my application
> > i didn't close connection just close statment created
> > by connection. is this the problem?
> > and where i can check how many process in mysql?
> > Very appreciate your help.
> > --- Samuel Chen <[EMAIL PROTECTED]> wrote:
> > > You might check out how many mysql processes are
> > > running.
> > > If you did not close the database connections
> > > properly,
> > > mysql will have to open too many connections and
> > > eventually
> > > everything will be slowed down, even your servlet
> > > engine can be crashed.
> > >
> > > Sam.
> > > --------------------------------------
> > > Need a Bug Tracking System?
> > > Try http://www.websina.com/bugzero/
> > > --------------------------------------
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: "bin cai" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Monday, August 12, 2002 8:58 AM
> > > Subject: connection reset by peer, system slow down
> > >
> > >
> > > > Hello,
> > > > I got one serious problem. any help will be
> > > > appreciated very much. Thanks in advance.
> > > > my project is about online exam. students take
> > > exam
> > > > through internet.This sytem is developed by java
> > > > servlet, html, mysql and tomcat 3.2.3. Last Friday
> > > we
> > > > have a test on my system. some students took the
> > > exam
> > > > for half hour.
> > > > It seemed ok. after exam, we (3 guys) had a
> > > further
> > > > tesing on my system. we try to log to system using
> > > > different login ids at the same machine. or using
> > > same
> > > > loin id to log to sytem at different machines. but
> > > the
> > > > sytem suddenly slow down. very slow. when i check
> > > the
> > > > server, find the waning message like "socket
> > > > exception....connection reset by peer.
> > > > I read some documentation about this error. i was
> > > > informed that the message will happen when client
> > > send
> > > > another request before the previous request is
> > > > returned. it will not hurt the performance. but in
> > > my
> > > > case my system has slowed down obviously.
> > > > any one can give me some hint? i will appreicate
> > > it
> > > > very much.
> > > > bin
> > > >
> > > >
> > >
> > ______________________________________________________________________
> > > > Post your ad for free now!
> > > http://personals.yahoo.ca
> > > >
> > > >
> > >
> >
___________________________________________________________________________
> > > > 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
> > >
> >
> > ______________________________________________________________________
> > Post your ad for free now! http://personals.yahoo.ca
> >
> >
___________________________________________________________________________
> > 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