Symptoms
Consider the following scenario:
-
You have a contained database in Microsoft SQL Server 2012 or SQL Server 2014.
-
An application tries to connect to the contained database by enabling connection pooling.
-
The application uses SQL Server authentication.
In this scenario, the application may be unable to connect to the database. Additionally, you find errors that resemble the following in the SQL Server error log:
date time Logon Error: 18456, Severity: 14, State: 5.
datetime Logon Login failed for user 'SID'. Reason: Could not find a login matching the name provided [Client:] datetime spid# Error: 18056, Severity: 20, State: 5. datetime spid# The client was unable to reuse a session with SPID #, which had been reset for connection pooling. The failure ID is #. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message.Note This problem does not occur the first time that a connection to a contained database occurs. However, the problem does occur on all successive attempts.
Resolution
The issue was first fixed in the following cumulative update of SQL Server.
Cumulative Update 1 for SQL Server 2014 /en-us/help/2931693
Cumulative Update 7 for SQL Server 2012 SP1 /en-us/help/2894115
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
More Information
This update also fixes another problem in which the following built-in functions return the user SID instead of the user name:
-
SUSER_SNAME
-
SUSER_NAME
-
SYSTEM_USER
Note This update makes sure that the user name is always returned by these functions, whether or not a contained database is used.
References
See the terminology Microsoft uses to describe software updates.