The locking information file stores computer and user-level security account names and has extended byte range locks placed on it by Microsoft Jet. One locking information file is created for every Microsoft Jet database file that is opened in shared mode. The file always retains the same name as the database that was opened, except with an .ldb file extension. For example, Northwind.mdb has an associated locking information file called Northwind.ldb. If the locking information file doesn’t exist when the database is opened, Microsoft Jet creates it in the same directory as the database.
The physical structure of the locking information file can best be thought of as an array of up to 255 elements. Each element contains 64 bytes and represents a user. The first 32 bytes contain the computer name of the user (such as Kevin’s Computer) and the second 32 bytes contain the user’s user-level security account name (such as Admin). The computer name is the machine name supplied by the operating system (Microsoft Windows 95 or Microsoft Windows NT Workstation).
Microsoft Jet retrieves the computer name by making a request to the operating system. To view or modify the computer name in Windows for Workgroups, Windows 95, or Windows NT Workstation, open the Control Panel and double-click the Network icon. The computer name can be changed on the Identification tab. Windows for Workgroups stores the computer name in the Network section of the System.ini file. Windows 95 and Windows NT Workstation store the computer name in the \HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ ComputerName\ComputerName key in the Windows Registry.
The user-level security account name is determined by passing a value to the DAO Workspace object. The default user-level security account name is Admin.
The physical size of the locking information file never exceeds 16320 bytes. This is because the maximum number of concurrent Microsoft Jet users is 255 (255 * 64 = 16320). Each element in the array is used by Microsoft Jet to determine which users are holding locks on data.
To lock data, Microsoft Jet places extended byte range locks outside of the physical boundaries of a file — no data is physically locked. An example of an extended byte range lock is a lock placed at 10 million hexidecimal (h) for a file that has a physical size of only 64 bytes. In this case, a lock is placed at a virtual location that does not exist on the hard disk. Extended byte range locks are used because they’re not limited by the size of the physical file, thus allowing for locking algorithms that would not otherwise be possible. Also, placing locks inside a data file prevents other users from reading that data. For example, in the earlier versions of dBASE, a user could place a lock on a record located in the data file, preventing everyone else from reading that data.
Note Unlike Microsoft Jet 2.x, versions 3.0 and 3.5 automatically delete the locking information file when the last user closes the database. This is done to reduce the proliferation of lock files for replicated databases and to allow for performance gains when determining which users have locks open. However, this automatic deletion cannot occur if the user doesn’t have sufficient operating system or network operating system rights to delete the file, or the database is in a suspect state (data locking issues can’t be resolved).
Note You can use the Msldbusr.dll utility to programmatically retrieve the following information if you’re running 32-bit VBA applications or using Visual C++: the list of all users in a locking information file, the list of all connected users in a locking information file, and the list of users who left the database in a suspect state. For information about how to use this utility and for more information about Microsoft Jet locking, see “Understanding Microsoft Jet Locking” in the Papers folder on the companion CD-ROM. Its file name is Jetlock.doc.