This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes locking access to tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "locking access to tables" Watch "locking access to tables" New topic
Author

locking access to tables

Graham Clark
Greenhorn

Joined: Jun 13, 2002
Posts: 17
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

Joined: Nov 06, 2000
Posts: 1510
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.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
 
subject: locking access to tables
 
Similar Threads
accessing a row
HFS page274, question7
Initialising Database connections with JSP
confused about session scope....
Database Connection