Hi all,

I'm really just after a bit of advice here....

I'm developing a jsp application which will be used to book timeslots over
the web. The database has a record for each hour in the day, and timeslots
are booked by storing the username of the person who booked it in a field in
the row for a particular hour.

If two users try to book the same timeslot at exactly the same time, I could
get corrupted data. Since i'm using MSaccess for development, I can't
incorporate locking the database row, so Ive done it like this:

The actual booking (writing the username to the database) is done with a
bean, and the booking method (which connects to the db, checks there's no
username already there and then writes the current username with an UPDATE
sql string), is synchronized. The bean has application scope.

so firstly - does this sound ok? will it protect my data from concurrent
access by making the second request wait?
secondly - any ideas on how I can test this? I mean, the requests will have
to happen at exactly the same so I can't be sure if check it manually.

thanks,

Paul

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to