Solved

Handling Locking in MS Access

Posted on 2004-08-16
4
188 Views
Last Modified: 2010-04-15
I have a situation where two different programs may be attempting to access the same MS Access database. Is there any way to account for this condition? I was thinking about maybe putting someting in the catch portion of a try-catch block which would take appropriate action if the database could not be accessed. In other words, if the first attempt to access the database was unsuccessful, there would be a small wait period, then another attempt. This would continue until the operation was successful.

Would this work? How would I do it?

Thanks!

- nhc
0
Comment
Question by:nh_capricorn
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
TheAvenger earned 250 total points
ID: 11810099
Normally there is no problem that 2 or more applications access the same database (even an Access one). Problems may appear only if two users try to change the same record in the same table in the same database. As Access is a little bit "stupid" it may cause you problems if 2 users try to access at the same time some neighbouring records. However you should first make tests and maybe you will never meet a problem or the problem will be so rare that it is not worth the work to check it/recover it.
0
 
LVL 7

Assisted Solution

by:NipNFriar_Tuck
NipNFriar_Tuck earned 250 total points
ID: 11810845
There are different types of locking that can be set up when accessing the database.  If the locking is setup to record level locking then you are less likely to run into issues, where as I believe that by default MS Access is setup to be table locking.  Of course all applications have to be set to the same level of locking otherwise the race condition could still exist.
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 11810880
I think default for Access is record locking. Still not sure....
0
 

Author Comment

by:nh_capricorn
ID: 11873005
Thank you both. I did some simple tests, and didn't discover any real issues. I may, however need to change the way locking is setup at some point. (Hence the reason for the split: both solutions were useful.)

- nhc
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question