80004005 couldnt Lock File error resolution when Access is received

Source: Internet
Author: User
Tags odbc access database
Access| Error | Resolution applies to:

Microsoft Active Server Pages
Microsoft Data Access Components 1.5
Microsoft Data Access Components 2.0
Microsoft Data Access Components 2.1
Microsoft Data Access Components 2.1 SP1
Microsoft Data Access Components 2.1 SP2
Microsoft Data Access Components 2.5
Microsoft Data Access Components 2.5 SP1
Microsoft Data Access Components 2.5 SP2
Microsoft Data Access Components 2.6


--------------------------------------------------------------------------------


This is article was previously published under Q306441

The occurrence of the problem

When we try to connect to an MS Access database with ActiveX Data Objects (ADO) and Open Database Connection (ODBC), you may return the following error message:

Microsoft OLE DB Provider for ODBC Drivers error ' 80004005 '
[Microsoft] [ODBC Microsoft Access Driver] Couldn ' t lock file.


The cause of the occurrence
This error message is generated because you do not have permission to create a lock file (. ldb) file on an MS Access database. The system defaults to the creation of lock file (. ldb) in the same directory as a Microsoft Access. mdb file.

Solving method
Follow the steps below:
1. Users who grant access to the database (usually iusr_<computername> account) have complete control over the shared folder.
2. Since lock file (. ldb) files are often set to read-only (read-only), sharing is often restricted. So, we can try to change the connection by using the following demo code:

Set Conn = Server.CreateObject ("ADODB. Connection ")
Conn.mode = adModeShareDenyWrite ' 8

' The definition in the Adovbs.inc
'----ConnectModeEnum Values----
' Const adModeUnknown = 0
' Const adModeRead = 1
' Const adModeWrite = 2
' Const adModeReadWrite = 3
' Const adModeShareDenyRead = 4
' Const adModeShareDenyWrite = 8
' Const admodeshareexclusive = &AMP;HC
' Const adModeShareDenyNone = &h10


Reference bibliography
To learn more, please click on the following connection:
174943 prb:80004005 "couldn ' t use ' (unknown)"; File already in use "

183060 info:troubleshooting Guide for 80004005 and other Error Messages



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.