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/ODBC/SQL Server Error 0x80040E4D "Login Failed for User '(Null)'"


Symptoms

If you try to use an ODBC Data Source Name (DSN) to open an ActiveX Data Objects (ADO) connection to a SQL Server database from an Active Server Pages (ASP) page, you may receive the following error message:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

↑ Back to the top


Cause

This error can occur under the following circumstances:

  • You are trying to establish a trusted connection, and the Microsoft Windows NT or Windows 2000 user account that Internet Information Server (IIS) uses to process the request for the ASP page does not have a corresponding NT Authentication login in SQL Server.
  • You are trying to use standard SQL Server authentication to establish a connection, and the UID parameter is not specified in the ADO connection string.

↑ Back to the top


Resolution

To resolve this problem, use one of the following methods:

  • Ensure that a Windows authentication SQL Server login exists for the Windows NT/Windows 2000 user account that IIS uses to process the request for the ASP page. If a login does not exist, use SQL Server Enterprise Manager to create it.For additional information on how to configure NT authentication SQL Server login(s) that ASP pages use, click the article number below to view the article in the Microsoft Knowledge Base:

    247931 INF: Authentication Methods for Connections to SQL Server in ASP
  • Make sure to include the Trusted_Connection=yes connection string parameter in the ADO connection string. If you do not include this parameter, the above-mentioned error occurs even if the Windows NT/Windows 2000 user account that is used to process the request for the ASP page has a corresponding Windows authentication login in SQL Server.
  • Make sure to specify the UID and the PWD connection string parameters if you want to use standard SQL Server authentication to establish a database connection. You must specify these parameters even if the configuration properties of the DSN are set to use standard SQL Server authentication. If you fail to specify these parameters, IIS tries to open a trusted connection to the database.

    To use standard SQL Server authentication to establish a connection, it is essential that you configure the security settings on the target SQL Server to permit Mixed mode (NT and SQL Server) authentication. If you specify a valid UID and omit the PWD parameter in the connection string, when the specified User ID contains a non-blank password, you receive the following error message:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user <SQL Server User Id specified in the connection string>.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More Information

The Windows NT/Windows 2000 user account that IIS uses 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 instance, when you use Anonymous authentication, the credentials of the configured IIS Anonymous account (which is the ISR_<WebServerName> account by default) are used to process the user request. When you use Basic authentication, Microsoft Internet Explorer prompts the user to supply a valid Windows NT/Windows 2000 Network User ID and Password whose credentials are then used to process the request.

Refer to the online IIS documentation for additional information about the supported authentication mechanisms and how they work.

↑ Back to the top


Keywords: kbsqlsetup, kbprb, kb

↑ Back to the top

Article Info
Article ID : 307002
Revision : 3
Created on : 4/18/2018
Published on : 4/19/2018
Exists online : False
Views : 410