Microsoft Knowledge Base Email Alertz

(306441) - When you use ActiveX Data Objects (ADO) and ODBC to try to connect to a Microsoft Access database, you may receive the following error message: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access 97 Driver]...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 306441 - Last Review: August 11, 2006 - Revision: 4.1

PRB: Troubleshooting Error 80004005 "Couldn't Lock File" in ASP

This article was previously published under Q306441

SYMPTOMS

When you use ActiveX Data Objects (ADO) and ODBC to try to connect to a Microsoft Access database, you may receive the following error message:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access 97 Driver] Couldn't lock file.

CAUSE

This error message occurs because you do not have the correct permissions to create the lock file (.ldb) for a Microsoft Access database. By default, a lock file is created in the same folder as the Microsoft Access .mdb file.

RESOLUTION

To resolve this problem, follow these steps:
  1. Grant the user who is accessing the database (usually the IUSR_<computername> account) full control to the share or folder.
  2. Sometimes permissions are restricted on the share because the file is intended to be read-only. You may want to try to change the connection mode, which the following code demonstrates:
       Set Conn = Server.CreateObject("ADODB.Connection")
       Conn.Mode = adModeShareDenyWrite    '8
        
       'From Adovbs.inc
       '---- ConnectModeEnum Values ----
       'Const adModeUnknown = 0
       'Const adModeRead = 1
       'Const adModeWrite = 2
       'Const adModeReadWrite = 3
       'Const adModeShareDenyRead = 4
       'Const adModeShareDenyWrite = 8
       'Const adModeShareExclusive = &Hc
       'Const adModeShareDenyNone = &H10
    					

STATUS

This behavior is by design.

REFERENCES

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
174943  (http://kbalertz.com/Feedback.aspx?kbNumber=174943/EN-US/ ) PRB: 80004005 "Couldn't Use '(unknown)'; File Already in Use"

APPLIES TO
  • Microsoft Active Server Pages 4.0
  • Microsoft Data Access Components 1.5
  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.1 Service Pack 1
  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.5 Service Pack 1
  • Microsoft Data Access Components 2.5 Service Pack 2
  • Microsoft Data Access Components 2.6
Keywords: 
kbprb KB306441
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate