Automatic .ldb File Creation and DeletionFor every database opened for shared use, an .ldb file is created to store computer and security names and to place extended byte range locks. The .ldb file always has the same name as the opened database (.mdb) and is located in the same folder as the opened database. For example, if you open (for shared use) the Northwind.mdb sample database in the C:\Program Files\Microsoft Office\Office\Samples folder, then a file called Northwind.ldb is automatically created in the same folder.
Whenever the last user closes a shared database, the .ldb file is deleted. The only exceptions are when a user does not have delete rights or when the database is marked as corrupted; then, the .ldb file is not deleted because it contains information about who was using the database at the time the database was marked as corrupted.
Required Folder PrivilegesIf you plan to share a database, the .mdb file should be located in a folder where users have read, write, create, and delete privileges. Even if you want users to have different file privileges (for example, some read-only and some read-write), all users sharing a database must have read, write, and create permissions to the folder. You can, however, assign read-only permissions to the .mdb file for individual users while still allowing full permissions to the folder.
NOTE: If a user opens a database with exclusive access (by clicking the Exclusive check box in the Open dialog box), record locking is not used; therefore, Microsoft Access does not attempt to open or create an .ldb file. If the database is always opened for exclusive use, a user needs only read and write privileges to the folder.
The .ldb File ContentsFor each person who opens a shared database, the Jet database engine writes an entry in the database's .ldb file. The size of each .ldb entry is 64 bytes. The first 32 bytes contain the computer name (such as JohnDoe). The second 32 bytes contain the security name (such as Admin). The maximum number of concurrent users that the Jet database engine supports is 255; therefore, the .ldb file size is never larger than 16 kilobytes.
When a user closes a shared database, the user's entry is not removed from the .ldb file. However, it may be overwritten when another user opens the database. This means that you cannot use the .ldb file alone to determine who is currently using the database.
The .ldb File UsageThe Jet database engine uses .ldb file information to prevent users from writing data to pages that other users have locked and to determine who has other pages locked. If the Jet database engine detects a lock conflict with another user, it reads the .ldb file to get the computer and security name of the user who has the file or record locked.
In most lock conflict situations, you receive a generic "Write conflict" message that allows you to save the record, copy it to the Clipboard, or drop the changes you made. In some circumstances, however, you receive the following error message:
For additional information about how to do this and sample code, click the article number below to view the article in the Microsoft Knowledge Base:
รหัสบทความ: 208778 - การตรวจสอบครั้งสุดท้าย: 26 ม.ค. 2005 - ฉบับแก้ไข: 1