Symptoms
If you try to use a Microsoft Jet (Access) database from multiple instances of the same application either on the same computer or on different computers, you receive the following error message:
-2147467259 Error ODBC Microsoft Access Driver: The database has been placed in a state by an unknown user that prevents it from being opened or locked.
This error occurs with both the Microsoft ODBC Driver for Access and the OLE DB Provider for Jet.
Cause
To run an .mdb file by multiple instances, Jet makes use of a lock delay and retry interval. However, under high load conditions, you may exceed these intervals.
Resolution
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. https://partner.microsoft.com/global/30000104 Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMSThe following workaround extends the retry delay for Jet so that you can use additional instances. However, it is not recommended that you use this workaround if a high number of updates are being formed; this workaround is intended only for reading databases. You can add the following sample error handler to your code. Please note that this handler only works with ADO and uses the Sleep function, which you must declare in your general declarations section.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners -RetryHandler:
' Retry until MAX_RETRIES are hit to increment your error count. errorcount = errorcount + 1 If errorcount < MAX_RETRIES Then ' Sleep a random amount of time, and retry the same operation. Sleep Int(MAX_SLEEP_INTERVAL * Rnd) + 1 Resume Else ' Retries did not help. Show the error, and fall out. MsgBox Err.Number & " " & Err.Description Exit Sub End If
Status
This behavior is by design.
More Information
The above-mentioned workaround is only for read-only mode. Microsoft does not support placing Jet .mdb files under high user load. Microsoft strongly recommends that you use Microsoft SQL Server or Microsoft Data Engine (MSDE) instead of Access when high user loads (that is, more than 15 instances) are required or anticipated, especially when updating is required.
References
For more information about the Sleep function, refer to the MSDN Library documentation.