Probably, the more powerful way to do it is with a pool of connections. It has
been discussed many times
in this list. There are a lot of articles and code on the net on this issue.

Another possibility is to use the connections as local variables, instead of
attributes. In this way each request
have their own connection, and you get rid of the multithreading stuff.
pros:
* Simple
cons:
* Worse perfomance (you need to create a new connection in each request)
* You can reach the maximum number of connections availables and fail.

Hope it helps.

Nitin Kulkarni wrote:

> Hello All,
>
> I need some help regarding multiuser programming using Servlet. We have
> developed an application which runs as follows
>
> HTML ----> Servlet----->
>                                       Database(MS Access)
> HTML  <---Servlet<-----
>
> The problem here is that we are opening just one connection to the database in
> the init() of the servlet and using the same connection for any request coming
> from any user.
>
> This could led to problems of data corruption such as variable getting changed
> before the query which uses it gets executed (This would happen if two users
> access the servlet at the same time).
>
> The two solutions known to handle this problem are syncronising or using
> SingleThreadModel.  But both these methods have their drawbacks. Also these
> handle multithreading aspect rather than multiuser. Is there any third way to
> handle this kind of a multiuser aspect.
>
> Quick help will be appreciated.
>
> Thanks
>
> Nitin

--
------------------------------------------------
Manuel Hurtado Sanchez
Telefonica Data
Phone: +34 917548650
Fax:   +34 917548692
Julian Camarillo,6
28037 Madrid, Spain.
------------------------------------------------

___________________________________________________________________________
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