Reply to topic
Using an Access database? Hate lock files?
Lane


Joined: 12 May 2005
Posts: 14
Location: Newark Dela-where?
Reply with quote
FROM THE MICROSOFT KNOWLEDGE BASE (now it makes sense)

http://support.microsoft.com/kb/q208778/

==============================
SUMMARY
The .ldb file plays an important role in the multiuser scheme of the Microsoft Jet database engine version 4.0. The .ldb file is used to determine which records are locked in a shared database and by whom.

MORE INFORMATION
Automatic .ldb File Creation and Deletion
For 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 Privileges
If 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 Contents
For 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 Usage
The 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:
Couldn't lock table <table name>; currently in use by user <security name> on computer <computer name>.
NOTE: The state of the information in the .ldb file has no bearing on the state of the database. If an .ldb file becomes corrupted, everything in the database should still work correctly. However, you may see scrambled text instead of user names in any lock conflict messages.
==============================[url][/url]
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1029
Location: Felton, Delaware
Reply with quote
... uh, yeah... this just an infopost?
Connie


Joined: 26 Mar 2005
Posts: 176
Location: The Internet
Reply with quote
Those lock files sure can be nasty little things when you are trying to update. This post does give a better explaination of why they are there. HMS does have an article about this on their support pages here.

Anyone know of other ways to unlock the lock file? The mentioned steps work, well only sometimes. Be nice to have an alternative method if anyone has discovered or come upon one.
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1029
Location: Felton, Delaware
Reply with quote
Well, if you're using ASP or ASP.NET, just make a page called closedb.asp(x) and, for the asp.net page, it should be similar to this:

Code:
dim Conn as new oledbconnection(connectionstringgoeshere)

Sub Page_Load()
    dim ConnState as string = Conn.State.ToString()
    If ConnState = "Open" Then
        Try
            Conn.Close()
            Response.Write("The database was closed successfully.")
        Catch Exc As Exception
            Response.Write("The database was opened and could not be closed:<br />" & Exc.ToString().Replace(Environment.NewLine(),"<br />")
        End Try
    Else If ConnState = "Closed"
        Response.Write("There must be something else wrong...  the database is already closed.")
    Else
        Response.Write("You should probably take up another career...  the database was not opened OR closed...  :|  ")
    End If
End Sub


And of course ASP would be adjusted accordingly...
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
Use SQLServer...
Shaji


Joined: 21 Feb 2005
Posts: 83
Reply with quote
Yes, use SQL Server. Do anyone know that Access is one of Bill Gates' toys? Rolling Eyes
Connie


Joined: 26 Mar 2005
Posts: 176
Location: The Internet
Reply with quote
MS SQL is a bit buggy as well.. Although I haven't use it for anything I've used on the web. Personally I actually like using MySQL in combination with phpMyAdmin. It just runs...it's like magic!
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
What bugs have you encountered in MSSqlServer?



The only reason why I never liked MySQL is because you could never do Stored Procedures - a HUGE drawback to any kind of real professional grade DB IMHO. In v 5 od MySQL you are supposed to be able to use them now however. PostgreSQL is/was a better choice for an open source DB IMHO. It has a nice webbased fornt end just like phpMyAdmin and has always supported stored procedures.
Using an Access database? Hate lock files?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic