Microsoft KB Archive/307640

= PRB: Error -2147467259 When You Try to Open the Same MDB File from Multiple Instances =

Article ID: 307640

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft ActiveX Data Objects 2.1
 * Microsoft ActiveX Data Objects 2.1 Service Pack 1
 * Microsoft ActiveX Data Objects 2.1 Service Pack 2
 * Microsoft ActiveX Data Objects 2.5
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft ActiveX Data Objects 2.7
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 3
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 4
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 5

-



This article was previously published under Q307640



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. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

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;CNTACTMS

The 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. 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 & &quot; &quot; & 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.

