Couple of suggestions for you:
(1) Switch to a more robust/feature-filled database. :)
(2) Use database transactions to isolate modifications to the data; however,
this still serializes access to the database so long as you use a single
connection.
(3) Store all your per-user variables/class members in session Hashtables,
keyed by session ID; this still doesn't prevent multiple users from using
the same Connection simultaneously, however, and data corruption is still a
possibility. It really depends on how robust Access (and/or the JDBC-ODBC
Bridge driver) is about separating Statements created from the same
Connection.
(4) Simply face up to the fact that you need to deal with
multiuser/multithreading issues (they're really one and the same, as far as
your app is concerned right now) and either accept the drawbacks of
synchronization, or else open multiple Connections, one per user. When you
consider that ODBC does some connection pooling on its own, anyway, this may
be less of a cost than you think.
There is no real silver bullet in this situation--either SingleThread your
servlet, or synchronize the sensitive parts; there is no alternative.
Ted Neward
Patterns/C++/Java/CORBA/EJB/COM-DCOM spoken here
http://www.javageeks.com/~tneward
"I don't even speak for myself; my wife won't let me." --Me
-----Original Message-----
From: Nitin Kulkarni <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, July 27, 1999 9:13 PM
Subject: Multiple users accessing a servlet
>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
>
>___________________________________________________________________________
>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