Microsoft KB Archive/306345

= PRB: ASP Error 80004005 &quot;Data Source Name Not Found&quot; =

Article ID: 306345

Article Last Modified on 8/11/2006

-

APPLIES TO


 * Microsoft Active Server Pages 2.0
 * Microsoft Active Server Pages 3.0
 * Microsoft Internet Information Server 4.0
 * Microsoft Internet Information Services 5.0
 * 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
 * Microsoft Data Access Components 2.6 Service Pack 1
 * Microsoft Data Access Components 2.7

-



This article was previously published under Q306345



IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry



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.



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.



RESOLUTION
WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

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 &quot;References&quot; 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.

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 &quot;References&quot; 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.



STATUS
This behavior is by design.



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_ 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.

