Error: Failed to connect to database. Cannot acquire a schema lock because of an existing lock
When using UNC pathnames to access data in a personal geodatabase opened by another user or application, the following error message may be encountered:
"Failed to connect to database."
"Cannot acquire a schema lock because of an existing lock."
"Could not use <filename>; file already in use."
Trying to open the MDB file through a UNC path in Microsoft Access raises a similar error:
"Could not lock file. (Error 3050)"
This error may occur due to any number of actions or workflows in ArcGIS; all of which involve opening the personal geodatabase when the following conditions are met:
- The personal geodatabase is already open.
- A UNC path is used to access the data in the personal geodatabase during the connection that is raising the error.
- The correct Sharing privileges are not granted on the folder containing the personal geodatabase.
When these three conditions are met, the operating system does not allow the Microsoft Jet Engine to create an .ldb file to lock the MDB file for access, which causes the error to be raised.
Solution or Workaround
This error can be avoided by closing all other applications accessing the personal geodatabase, or by not using UNC paths to access the personal geodatabase.
If it is not possible to use one of these solutions to avoid the error, the only remaining option is to modify the privileges of the folder containing the MDB file. To obtain a lock on the MDB file, write privileges need to be granted on the folder in which the MDB file is contained. To assign the correct privileges, follow the steps below.
- Open the Sharing and Security dialog box for the folder and select the Sharing tab.
- Click the Permissions command to open the Permissions dialog box.
- Make sure the user trying to open the MDB file has Change or Full permissions on the folder.
- If these steps do not work, consult the operating system or network documentation on how to properly assign write privileges to the folder.