• Post Reply Bookmark Topic Watch Topic
  • New Topic

locking access to tables

 
Graham Clark
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using a servlet to access an Access database through JDBC. While one particular block is executing, I don't want any other instatiations of the servlet (i.e. other users) accessing a particular table in the database.
Can this be set up in the ResultSet, or do I have to write some sort of synchronization code?
Any help would be much appreciated.
thanks,
Graham.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think the JDBC-ODBC driver which access uses even supports what you are trying to do (transactions). You can just synchronize the code block that contains the database access. OTOH, you can have your servlet implement the SingleThreadModel interface.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!