Hi, Geeta,
thank you for your help and suggestion. I haven't
tested my current implementation in the enviroment of
180 students. so far just i am testing it myself.
It will be tested by 180 students in this summber.

The reason why i have been worried about my
implementation is I used connection as local vairable
that is defined in doGEt(doPost) method. so every time
when user send request to server by a servlet, it will
create a new connection for this student and close it
after the servlet sends response to user.
so I think it will take a lot time to create
connection(it is time consuming). besides that, i
don't know how many connections mysql and tomcat can
support. In my implementation, I have written about 30
servlets that have to deal with database during the
exam. Could you tell me mysql and tomcat 3.2.3 can
have so many connections?  If one student try to open
a connection and fail, Should i give him some message?
saying trying again later?

Could you tell me my current implementation has the
possibility to handle 180 students taking exam at the
same time? If it is possible i will keep my
implementation until it will be tested. Thanks in
advance.

could you tell me is there any better alternative if
my current implementation were proven not to be good?
define connection as instance variable and implement
with singlethreadmodel is a good choice?

I am afraid to ask you one more question.
If i create an instance variable conncetion in init
method in each servlet, when and where i should use
destroy() method to close it. I think once i open one
connection i should keep it open until students finish
their exams? I am not sure about this issue, could you
give me some explanation?

thanks again and i appreciate very much your help.
Have a good day
sincerely
bin



--- Geeta Ramani <[EMAIL PROTECTED]> wrote:
> Yes, but you may really effect performance, wouldn't
> you? Seems like a very
> drastic solution to me.. - especially since there's
> such an straight-forward
> alternative..:)
>
> Geeta
>
> Walt Black wrote:
>
> > Connection can be an instance variable.
> > Have your servlet implement SingleThreadModel.
> > Create your database connection in the init()
> method of the servlet.
> > Voila! Instant thread/connection pool.  The draw
> back is that you do not
> > control the number of threads that will be
> created.  I'll be Tomcat will
> > create enough to support your needs.
> > Close connection and clean up in destroy() method.
> >
> > My question is have you already proven that your
> current implementation
> > couldn't support 180 students?  Are you solving a
> real problem or a perceived
> > problem?
> >
> > On Monday 27 May 2002 12:36 pm, you wrote:
> > > Thanks Geeta.
> > > How about i using "serializable" or
> "synchronozied"
> > > when i initialize servlet every time?
> > > Thanks again and have a good day
> > > bin
> > >
> > > --- Geeta Ramani <[EMAIL PROTECTED]> wrote:
> > > > Hi Bin:
> > > >
> > > > Defining connections as instance variables in
> your
> > > > servlet will not work
> > > > because as you rightly guessed you will have
> > > > threading problems. Your solution
> > > > is to create a pool. search among the archives
> (or
> > > > google) for "Connection
> > > > pool".
> > > >
> > > > Regards,
> > > > Geeta
> > > >
> > > > bin cai wrote:
> > > > > Hi,
> > > > > My application is about online exam with
> java
> > > >
> > > > servlet
> > > >
> > > > > as tool, tomcat 3.2.3 as server solution ,
> mysql
> > > >
> > > > 3.49
> > > >
> > > > > as the backend.
> > > > > considering 180 students take the exam at
> same
> > > >
> > > > time
> > > >
> > > > > within 50 minutes, there are a lot of
> transactions
> > > > > with database.
> > > > > what i did right now is to define connection
> in
> > > >
> > > > local
> > > >
> > > > > variable(within doGet or doPost method),
> every
> > > >
> > > > time
> > > >
> > > > > this servlet is called, new connection is
> created.
> > > > > after transaction is done, this connection
> is
> > > >
> > > > closed.
> > > >
> > > > > I am worrying the speed.(it will comsume a
> lot
> > > > > connection and time for open new
> connection).
> > > > >
> > > > > so I am thinking to define connection as
> instance
> > > > > variable in every servlet, so it can save
> sometime
> > > >
> > > > to
> > > >
> > > > > open new connection. However, I am not sure
> if it
> > > >
> > > > will
> > > >
> > > > > cause multi-thread problem? How and when i
> can
> > > >
> > > > close
> > > >
> > > > > the connection.
> > > > >
> > > > > Thank you very much
> > > > > bin
> > >
> > >
>
______________________________________________________________________
> > >
> > > > > Find, Connect, Date!
> 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
> > >
> > >
>
______________________________________________________________________
> > > Find, Connect, Date! 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".
>
>
=== message truncated ===


______________________________________________________________________
Find, Connect, Date! 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

Reply via email to