Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: ASP Error 80004005 "Data Source Name Not Found"


View products that this article applies to.

Symptoms

When you use ActiveX Data Objects (ADO) or ODBC to open a database connection in an Active Server Pages (ASP) page, you may receive the following 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.

↑ Back to the top


Cause

This error can occur when you use a DSN-based connection string (a connection string that uses a System DSN) or a DSN-less connection string with ADO and ODBC to open a database connection in an ASP page. The common causes of this error are listed below.

Using an ODBC DSN

  • The Microsoft Windows NT 4.0 or Windows 2000 user account that is used to process the request for the ASP page does not have sufficient permissions to read the registry key that stores the specified DSN's configuration information.
  • The System ODBC DSN that is specified in the ADO connection string does not exist on the IIS server.
  • The ASP Application or Session variable that is initialized in the ASP application's Global.asa file (or in an ASP page that is accessed before the page that contains the database connection code) is used to specify the ADO connection string. This connection string variable is not initialized when the code to open the database connection is run. To confirm this, add a Response.Write statement before the line of code that opens the database connection to display the connection string that is stored in the variable.

Using a DSN-Less Connection String

  • The Windows NT 4.0 or Windows 2000 user account that is used to process the request for the ASP page does not have sufficient permissions to read the registry key that stores the specified ODBC Driver's configuration information. The Driver parameter in a DSN-less connection string specifies the ODBC driver that is used to establish the database connection.
  • The name of the ODBC driver that is specified in the connection string is misspelled or specifies a driver that is not installed on the Internet Information Server (IIS) server.
  • The ASP Application or Session variable that is initialized in the ASP application's Global.asa file (or in an ASP page that is accessed before the page that contains the database connection code) is used to specify the ADO connection string. This connection string variable is not initialized when the code to open the database connection is run. To confirm this, add a Response.Write statement before the line of code that opens the database connection to display the connection string that is stored in the variable.

↑ Back to the top


Resolution

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows

Using an ODBC DSN

Insufficient Permissions to Read the DSN Registry Key

Grant the Windows NT 4.0 or Windows 2000 user account Read access to the specified ODBC System DSN registry key as follows:
  1. Determine which account is used to process the request for the ASP page.
  2. From the Start menu, click Run, type regedt32.exe, and then click OK to start Registry Editor.
  3. In the HKEY_LOCAL_MACHINE window, browse to the HKLM\SOFTWARE\ODBC\ODBC.INI key. The ODBC.INI key contains a subkey for each ODBC SYSTEM DSN that is registered on the server.
  4. Click the DSN registry key for the DSN that is specified in the ADO connection string.
  5. From the Security menu, click Permissions.
  6. Add the user account that you identified in step 1 to the list of users who can access this key, and select the Read check box for this user.
  7. Click Apply, and then close Registry Editor.

Specified DSN Does Not Exist on the IIS Server

Create the specified System ODBC DSN on the IIS Server.

Global.asa Code to Initialize the ADO Connection String Is Not Running

  1. Verify that the IIS Application folder has been set up as an IIS virtual directory with permissions to execute scripts.
  2. Verify that the Global.asa file is located in the IIS application's root directory.
  3. If the Application folder is already set up as an IIS virtual directory, remove and re-create the IIS application.
  4. Refer to the articles that are listed in the "References" section to determine if any of these articles apply to your specific scenario.
  5. Contact Microsoft Product Support Services if the code in Global.asa still does not appear to be running after you perform the preceding steps.

Using a DSN-Less Connection String

Insufficient Permissions to Read the Specified ODBC Driver Registry Key

Grant the Windows NT 4.0 or Windows 2000 user account Read access to the specified ODBC Driver registry key as follows:
  1. Determine which account is used to process the request for the ASP page.
  2. From the Start menu, click Run, type regedt32.exe, and then click OK to start Registry Editor.
  3. In the HKEY_LOCAL_MACHINE window, browse to the HKLM\SOFTWARE\ODBC\ODBCINST.INI key. The ODBCINST.INI key contains a subkey for each ODBC Driver that is installed on the server.
  4. Click the Driver registry key for the Driver that is specified in the ADO connection string.
  5. From the Security menu, click Permissions.
  6. Add the user account that you identified in step 1 to the list of users who can access this key, and select the Read check box for this user.
  7. Click Apply, and then close Registry Editor.

Driver Name Is Misspelled or Is Not Installed on the IIS Server

Verify that the ODBC Driver name is spelled correctly in the ADO connection string. In addition, verify that the specified driver is installed on the IIS Server. To view a list of ODBC drivers that are installed on a system, look in the ODBC Data Source Administrator (Odbcad32.exe) on the Drivers tab.

Global.asa Code to Initialize the ADO Connection String Is Not Running

  1. Verify that the IIS Application folder has been set up as an IIS virtual directory with permissions to execute scripts.
  2. Verify that the Global.asa file is located in the IIS application's root directory.
  3. If the Application folder is already set up as an IIS virtual directory, remove and re-create the IIS application.
  4. Refer to the articles that are listed in the "References" section to determine if any of these articles apply to your specific scenario.
  5. Contact Microsoft Product Support Services if the code in Global.asa still does not appear to be running after you perform the preceding steps.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

The Windows NT 4.0 or Windows 2000 user account whose credentials are used to process a request for an ASP page is determined by the authentication mechanism that the Web Server uses to authenticate the user request. For example, if you use Anonymous authentication, the credentials of the configured IIS Anonymous account (the IUSR_<WebServerName> account by default) is used to process the user request. When you use Basic authentication, Microsoft Internet Explorer prompts the user to supply a valid Windows NT 4.0 or Windows 2000 Network UserId and password whose credentials are then used to process the request. For additional information about the supported authentication mechanisms and how they work, refer to the online IIS documentation.

↑ Back to the top


References

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
188715 Global ASA Not Firing When Visual InterDev Made IIS 4.0 Application
288245 PRB: Global.asa Does Not Fire from Personal Web Server on Windows 98
265275 FP2000: Global.asa Does Not Run in FrontPage Web

↑ Back to the top


Keywords: kbprb, KB306345

↑ Back to the top

Article Info
Article ID : 306345
Revision : 9
Created on : 8/11/2006
Published on : 8/11/2006
Exists online : False
Views : 612