Source: qq Forum
The information in this article applies:
Microsoft Data Access Components versions 1.5, 2.0, 2.1, 2.5
Active Server Pages
Microsoft Visual InterDev and version 1.0
----------------------------------------------------------------------------
Summary
This article describes in detail some common causes for the Microsoft Data Access Component (MDAC) to receive the error 0x800040005. MDAC includes ActiveX Data Objects, ole db, and Remote Data Service (RDS ). This article also discusses other error messages, including 80040e21, 80040e14, and 80040e10.
More information
80004005 error messages can be summarized as: "For some reason, I cannot access your data ". This article provides a list of various 80004005 error messages, including the most common causes of these error messages and troubleshooting steps. Although this document assumes that you are on the Active Server Page (ASP) Page (. activeX Data Objects (ADO) are used in asp, but these causes and many troubleshooting steps are also applicable to any other environment that accesses data through ODBC.
Error message list
This section describes the text of various error messages and the causes of errors.
Error Message
Microsoft ole db Provider for ODBC Drivers error 80004005 [Microsoft] [ODBC Microsoft Access 97 Driver]
The Microsoft Jet database engine cannot open the file (unknown). It is already opened exclusively by another user, or you need permission to view its data.
Cause
This error occurs generally because the account used by Internet Information Server (IIS) (usually IUSR) does not have the correct Windows NT permission, therefore, you cannot access a file-based database or a folder containing files. Check the permission settings for these files and folders. Make sure that you can create and/or delete any temporary files. Temporary
Files are generally created in the same folder as the database, but can also be created in other folders, such as/Winnt. You can use the Windows NT File Monitor to check the cause of File Access failure. Windows NT File Monitor can be obtained from the following Web sites:
Http://www.sysinternals.com.
If you are using the network path of the database (UNC or image drive), check the permissions on sharing, files, and folders. Confirm that the file and Data Source Name (DSN) are not marked as exclusive. Use a system DSN that uses the local drive letter. If necessary, move the database to the local drive and test it. The other user (other users) in the error message may be Visual InterDev. Close any Visual InterDev project that contains the database data connection.
Errors may also be caused by delegation issues. Check any possible authentication methods ("basic" instead of NTLM ). If the connection string uses a unified Naming Convention (UNC), try "Basic Authentication" or an absolute path, such as C: MydataData. mdb. The preceding error may occur even if the resource that UNC points to is on the local IIS computer.
When you Access the Microsoft Access database linked to a table, if the table is in the Access database on the network server, this error may also occur. In this case, see the following Microsoft Knowledge Base Article to find a feasible solution:
Q189408 PRB: ASP cannot access network files under IIS 4.0
Error message: Microsoft ole db Provider for ODBC Drivers error 80004005 [Microsoft] [ODBC Microsoft Access 97 Driver] Couldnt use (unknown); file already in use.
Cause
The database cannot be properly locked for multiple users. For more information, see the following Microsoft Knowledge Base Article:
Q174943 PRB: 80004005 "Couldnt Use (unknown); File Already in Use"
Error Message
Microsoft ole db Provider for ODBC Drivers error 80004005 [Microsoft] [ODBC Driver Manager] Data source name not found and no default driver specified.
Cause
The most common cause is that the connection string session variables initialized in Global. asa and Global. asa are not stimulated. You can add the following code to the. asp page to check whether the variable is correctly initialized:
Another common cause is that there are too many spaces in the connection string.
DSN = MyDSN; Database = Pubs;
Try to use the following syntax instead:
DSN = MyDSN; Database = Pubs;
If Global. the asa file is not fired. check and confirm that it is under the application root of IIS 4.0. (If IIS 3.0 is running, it should be under the virtual root, and the Execute check box is selected ). In addition, when the Windows NT permission limits access to folders, an error in programming may also prevent the Global. asa file from being fired. For more information, see Microsoft Knowledge Base
Article:
Q173742 "BUG: when the Web access is restricted, Global. asa is not executed." The DSN name cannot be found.
Check and confirm that "user" type DSN is not used.
If the file DSN or system DSN is used, change the connection string to DSN = MySystemDSN or DBQ = MyFileDSN. Simplified!
Check and confirm that the latest driver is installed. If you are not sure, download the latest MDAC (Microsoft Data Access Component) from the following Web site ):
Http://www.microsoft.com/data/
Error Message
Microsoft ole db Provider for ODBC Drivers error 80004005 [Microsoft] [ODBC
Driver Manager] Data source name not ??
Cause
This issue seems to be related to the order in which software is installed or uninstalled on the computer. This error may occur if ODBC kernel files are not synchronized (they must be of the same version.
Download the latest version of MDAC (Microsoft Data Access Component) from the following Web site to upgrade all ODBC core drivers:
Http://www.microsoft.com/data/
Error Message
Microsoft ole db Provider for ODBC Drivers error 80004005 [Microsoft] [ODBC Access 97 ODBC driver Driver]
General error Unable to open registry key DriverId.
Cause
This error is caused by reading a value from the registry. Use Registry Editor (Regedt32.exe) to check the permissions set on the registry key. You can also use the Windows NT Registry Monitor (NTRegMon) to check whether the registry reading fails. NTRegMon can be
Download the following Web sites:
Http://www.sysinternals.com
Error Message
Microsoft ole db Provider for ODBC Drivers error 80004005 [Microsoft] [odbc SQL Server Driver] [dbnmpntw] ConnectionOpen (CreateFile ()).
Cause
There are two reasons for this error. They are related to permissions, the database and the Web server are not on one computer, or the database is being referenced through the UNC path (\ ServerShare. Even if the database and the Web server are on the same computer, the UNC path makes the Web server think that the database is on another computer on the network.
If the. asp page is being accessed by anonymous users, the following situations occur:
IIS will use (default) Windows NT account:
USR _.
Because this account is a local account of the Web server, other computers on the network cannot know the account. When IIS (running in the secure environment of the IUSR account) tries to access any resources on the remote computer, the remote computer will verify the account it uses. Because the IUSR account is a local account, it is unknown to the remote computer, so access is denied.
When anonymous access causes this problem, there are two solutions:
In the "Internet Service Manager" tool, change the Anonymous Logon account from the default local account to a valid domain-based account under the Web attribute. In the username field, enter the domain account to use in the format of domainuserid. In this way, the remote computer can use the domain controller to verify the security creden。 passed to it by IIS.
-Or-
Account copied on a remote computer that contains the resource you want to access
IUSR _. If the account is created on a remote computer with the same name and password
Are considered as equivalent accounts.
-Or-
If the. asp page only allows authenticated access, see the following:
If the page does not allow anonymous access, IIS will attempt to verify the identity of the requesting user and use its security creden。 to control all its activities, such as database access activities. Two main causes of failure are described below.
By default, IIS is configured with Windows NT Challenge/Response as its authentication method.
Due to Windows NT 4.0 (and earlier versions) Security Model restrictions, users who have passed Windows NT Challenge/Response authentication cannot access resources on remote computers. This usually
This is a delegation problem. To verify whether this is the case, select the basic (plaintext) check box under Web properties in the Internet service manager tool, and then clear Windows NT Challenge/Response. If this step solves the problem, it is obvious that this is a delegation problem.
-Or-
If the problem persists, it may be that the user account used does not have the correct SQL Windows NT Computer permission. Try to use an account that clearly grants access to this SQL computer.
For more information about how to delegate and IIS use Authentication to protect Web sites and related issues, see "IIS Authentication and
Security for Internet Developers ",
It is located on the following websites:
Http://www.microsoft.com/workshop/s...re/security.asp
Error Message
Microsoft ole db Provider for ODBC Drivers error 80004005 Microsoft] [ODBC Microsoft SQL Driver] Logon Failed ()
Cause
This error occurs when the SQL server does not accept or disapprove the submitted Logon account and/or password (when standard security is used ), or, if no Windows NT account is mapped to an SQL account (when integrated security is used), it is generated by the SQL server.
If standard security is used, the SQL account name and password are incorrect. Try using the system administrator account and password (UID = "SA", the password is blank ). These must be defined in the connection string line because DSN does not store the user name and password.
If integrated security is used, check the Windows NT account on the call page to find the target account mapped to it.
SQL does not allow the SQL account name to contain underscores. If someone manually maps Windows NT account IUSR_machinename to an SQL account with the same name, it will fail. Put