Hi Bin:

I'll try and answer your questions best as I can.. but you may want to also
check the archives (link at end of this email) for more details..

I believe your best bet is to implement a Connection Pool. Here's an
introductory article about using a pool within a servlet:
http://www.webdevelopersjournal.com/columns/connection_pool.html
There are many free pools which you should be able to use: A search on google
would probably yield riches..

I would strongly advice against single threaded models.. again this topic has
been discussed before: look in the archives!

As for creating an instance variable in your init() method, that will really be
a bad thing: the init() method is executed *only* at servlet initializion time
(*not* once per user). Plus, an instance variable, if declared within your
init() will not be accessible to either your doPost or doGet methods, and if
declared as a class variable (to your servlet) will be shared by all
students-definitely not something you want to happen. (One student's answers
will "get mixed up" with anothers!) The article I mentioned above will give you
a good idea about how you'd create the pool. get a connection, use it and
finally release it back to the pool.

Good luck!
Geeta

___________________________________________________________________________
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