Microsoft KB Archive/183060

From BetaArchive Wiki

INFO: Troubleshooting Guide for 80004005 and Other Error Messages

Q183060



The information in this article applies to:


  • Microsoft Data Access Components versions 1.5, 2.0, 2.1, 2.5
  • Microsoft Active Server Pages
  • Microsoft Visual InterDev, version 1.0





SUMMARY

This article presents details for common causes of the 0x800040005 error received by Microsoft Data Access Components (MDAC), including ActiveX Data Objects, OLE DB and the Remote Data Service (RDS). Several other error messages are discussed, including, 80040e21, 80040e14, and 80040e10.



MORE INFORMATION

The 80004005 error message can be summarized as "I couldn't get at your data for some reason." This article contains a listing of the various 80004005 error messages, the most frequent causes of the error messages, and troubleshooting steps to resolve them. While this article assumes you are using ActiveX Data Objects (ADO) within an Active Server Pages (ASP) page (.asp), the causes and many of the troubleshooting steps are applicable to any environment where ODBC is used for data access.

Error Message Listing

This section presents the text of each error message and the causes of each error.

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 may occur if the account being used by Internet Information Server (IIS), (usually IUSR), does not have the correct Windows NT permissions for a file-based database or for the folder containing the file.
  • Check the permissions on the file and the folder. Make sure that you have the ability to create and/or destroy any temporary files. Temporary files are usually created in the same folder as the database, but the file may also be created in other folders such as /Winnt.
  • Use the Windows NT File Monitor to check for file access failures. Windows NT File Monitor is available from the following Web site: http://www.sysinternals.com.
  • If you use a network path to the database (UNC or mapped drive), check the permissions on the share, the file, and the folder.
  • Check to make sure that the file and the data source name (DSN) are not marked as Exclusive.
  • Simplify. Use a System DSN that uses a local drive letter. Move the database to the local drive if necessary to test.
  • The "other user" might be Visual InterDev. Close any Visual InterDev projects that contain a data connection to the database.
  • The error may be caused by a delegation issue. Check the authentication method (Basic versus NTLM) if any. If the connection string uses the Universal Naming Convention (UNC), try using Basic Authentication or an absolute path such as C:\Mydata\Data.mdb. This may happen even if the UNC points to a resource local to the IIS computer.
  • This error may also occur when accessing a local Microsoft Access database linked to a table where the table is in an Access database on a network server. In this situation, please refer to the following article in the Microsoft Knowledge Base for a workaround:

    Q189408 PRB: ASP Fails to Access Network Files Under IIS 4.0

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access 97 Driver] Couldn't use '(unknown)'; file already in use.

Cause

The database cannot be locked correctly for multiple users. For more information, please refer to the following article in the Microsoft Knowledge Base:

Q174943 PRB: 80004005 "Couldn't 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 a session variable initialized in the Global.asa and Global.asa not firing. You may check to see that the variable is being initialized correctly by adding the following code to the .asp page:

       <%= "'auth_user' is " & request.servervariables("auth_user")%>
       <P>
       <%= "'auth_type' is " & request.servervariables("auth_type")%>
       <P>
       <%= "connection string is " & session("your_connectionstring")%>
       <P> 
  • Another common cause is using too many spaces in your connection string:

               DSN = MyDSN; Database = Pubs; 

    Try using this syntax instead:

               DSN=MyDSN;Database=Pubs;</ITEM> 
  • If the Global.asa file is not firing, check to make sure it is in an Application Root for IIS 4.0, or a Virtual Root with the "Execute" check box selected if running under IIS 3.0. Also, a bug may prevent the Global.asa file from being fired when Windows NT permissions have restricted access to the folder, detailed in the Microsoft Knowledge Base article Q173742 "BUG: Global.asa Not Executed If Restricting Web Access"
  • The DSN name is not found. Check to make sure a "User" type DSN is not being used.
  • If using a File or System DSN, try changing the connection string to "DSN=MySystemDSN" or "DBQ=MyFileDSN" as appropriate. Simplify!

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not ??

Cause

This appears to be an issue with the order in which software is installed and uninstalled on the computer. If the ODBC core files become unsynchronized (they should all be the same version) you may see this error.

Install the latest version of MDAC (Microsoft Data Access Components) from the following Web site to update all the core ODBC 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. Check the permissions on the registry key using the registry editor, Regedt32.exe. You may also want to use the Windows NT Registry Monitor to check for registry read failures. NTRegMon may be downloaded from the following Web site:

http://www.sysinternals.com

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][dbnmpntw]ConnectionOpen (CreateFile()).

Causes

There are two causes for this error. Both errors are permission-related issues and involve a database that is either on a different computer from the Web server, or the database is possibly being referenced using a UNC path (\\Server\Share). Even if the database is on the same computer as the Web server, UNC paths make the database appear to the Web server to be on a different computer on the network.

  • The following is true if the .asp page is accessed by an anonymous user:

    IIS will use (by default) a Windows NT account called:

       USR_<machinename>. 

    This account is local to the Web server and is essentially unknown to any other computers on the network. When IIS, operating under the security context of the IUSR account, tries to access any resources on a remote computer, the remote computer tries to validate the account being used. Because the IUSR account is a local account that is unknown to the remote computer, access is denied.

    There are two solutions when anonymous access causes this problem:

    • In the Internet Service Manager tool, under Web Properties, change the anonymous logon account from the default local account to a valid domain-based account. In the UserName field, enter the domain account to use as 'domain\userid'. This way, the remote computer can check with the domain controller to validate the security credentials passed to it by IIS.
    • Duplicate the

      IUSR_<machineaccount>  

      account on the remote computer that contains the resource you want to access. If an account is created on the remote computer that has the exact same name and password, Windows NT treats them as equivalent accounts.

  • If the .asp page only allows authenticated access, please refer to the following:

    If the page does not allow anonymous access, IIS tries to authenticate the user making the request, and uses their security credentials for all activities such as database accesses. The two primary causes for a failure in this scenario are described below.

    • By default, IIS is configured to use Windows NT Challenge/Response as the authentication method. Because of limitations in the Windows NT 4.0 (and prior versions) security model, a user that has been authenticated using Windows NT Challenge/Response cannot access resources on remote computers. This is commonly referred to as a delegation problem. To verify if this is the case, in the Internet Services Manager tool, under Web properties, select the Basic (Clear Text) check box and CLEAR the Windows NT Challenge/Response. If this solves the problem, then this is a clear delegation issue.
    • If problems persist, it is likely that the User account being used does not have rights to the SQL Windows NT computer. Try using an account that has known access to the SQL computer.

    For more information concerning delegation, how IIS uses authentication to secure a Web site, and problems such as this, please see the article "IIS Authentication and Security for Internet Developers" located at this Web address:

    http://www.microsoft.com/workshop/server/feature/security.asp

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80004005' Microsoft][ODBC Microsoft SQL Driver] Logon Failed()

Cause

This error is generated by SQL server if it does not accept or recognize the logon account and/or password being submitted (if using Standard security) or if there is no Windows NT account to SQL account mapping (when using Integrated security).

  • If you are using standard security, the SQL account name and password are incorrect. Try the system Admin account and password (UID= "SA" and NULL password). These must be defined on the connection string line. DSN's do not store user names and passwords.
  • If you are using integrated security, check the Windows NT account that is calling the page, and find out what account (if any) it is mapped to.
  • SQL does not allow an underscore in a SQL account name. If someone manually mapped the Windows NT IUSR_machinename account to a SQL account of the same name, it fails. Map any account that uses an underscore to an account name on SQL that does not use the underscore.

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][SQL Server] Login failed- User: Reason: Not defined as a valid user of a trusted SQL Server connection.

Cause

  • Integrated security is turned on in the SQL Enterprise Manager, and the Windows NT account being used has not been mapped to a SQL account.
  • Try changing SQL to use standard security (In Enterprise Manager, select Server/SQL Server/Configure[ASCII 133]/Security Options/Standard.
  • If running under IIS 4.0, deselect Password Synchronization for that project.

Error Message

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

Causes

  • May be caused by not having correct rights 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.
  • Try giving the user accessing the database (usually the IUSR_machinename account) full control to the share/folder.
  • Sometimes, permissions are restricted on the share because the file is intended to be read-only. You may want to try changing the connection mode using the following code example:

       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 

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access 97 Driver] '(unknown)' isn't a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

Cause

The path being read by the Web server is not a valid path. This most commonly happens when the Global.asa file is being used and the connection string was created on a different computer than the Web server. If the path is a mapped drive letter, it is probably only valid for the client computer that created the connection string.

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][SQL Server] The query and the views in it exceed the limit of 16 tables.

Cause

The query is too complex. There are several limitations on a query.

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][DBNMPNTW] ConnectionWrite (GetOverLappedResult()).

Cause

When the allow Anonymous User context is turned off, Windows NT is closing the pipe to SQL Server after the first request is complete. This is because the first connection to SQL Server is made under the IIS Anonymous User account. IIS then either impersonates the browser client on that same thread, or tries to access the connection on a different thread that is running in the impersonated user context. In either case, Windows NT would detect the attempt to use a network named pipe handle that had been opened in a different user context and force the pipe closed, per its security rules. When the connections are viewed on the SQL Server with a network monitor, a name pipe close request comes from Windows NT, causing the error in the Web browser.

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][DBMSSOCN] General network error. Check your network document

Cause

This may occur when a SQL server computer is renamed. DSNs that reference the old name fail when the computer name cannot be located.

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80040e21' Errors occurred

Cause

This may be caused by trying to insert more data into a field than is allowed. For example, inserting 26 characters into a Microsoft Access field that is formatted to accept only 25 characters.

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in INSERT INTO statement.

Cause

A column name may be a reserved word, such as DATE. Change the column name to a non-reserved name, such as "SaleDate".

Error Message

Microsoft OLE DB Provider for ODBC Drivers error '80040e10' [Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters. Expected 1.

Cause

The column name used in the query syntax does not exist. Often this is just a typographical error. Check the column names in a database against your query string. If you are using Microsoft Access, make sure that the actual column name is used and not a column's "display" name.



REFERENCES

For additional information please see the following articles:

Q178215 HOWTO: Configure VID to Work with an Authenticated Web Project

Q164534 INTECH XCLN Allow Multiple Lines Property Does Not Change

Q174943 PRB: 80004005 "Couldn't Use '(unknown)'; File Already in Use"


Q173742 BUG: Global.asa Not Executed If Restricting Web Access

Q172864 ASP Pages Fail on Access to Session and Application Objects

Q156526 General Error=51 Connecting to an Access Datasource

Q175671 PRB: 80004005 ConnectionOpen (CreateFile()) Error Accessing SQL

Q149425 IDC: Error Performing Query, Not Defined as a Valid User

Q167452 PRB: 'Not a valid path' Error when Using Access Data Source

Q125767 PRB: Query Too Complex Error After Execution of SQL Query

Q166659 PRB: Accessing SQL Database Fails on Second Attempt

Q166029 PRB: Cannot Open File Unknown Using Access

Q178215 HOWTO: Configure VID to Work with an Authenticated Web Project

Additional query words: 0x800040005 80040e21 80040e14 80040e10

Keywords : kbADO100 kbADO150 kbADO200 kbDatabase kbODBC kbRDS150 kbRDS200 kbDSupport kbMDAC200 kbMDAC150 kbMDAC210 kbMDAC250
Issue type : kbinfo
Technology : kbVisIDsearch kbAudDeveloper kbASPsearch kbMDACSearch kbMDAC150 kbMDAC200 kbMDAC210 kbMDAC250 kbVisID100


Last Reviewed: June 13, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.