Thursday, October 20, 2011

SimpleConcept: Message Error: 18456, Severity: 14, State: 38.


[Question]:
Message:
Message Error: 18456, Severity: 14, State: 38.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]
How to figure out what application to what database is trying to connect?

[Answer]:
State 38: Initial database could not be determined for session (SQL 2008)
The best way to investigate and locate the problem is SQL Server Profiler.
Run the trace with following trace properties:


And the filter:

You will see the ApplicationName from the request is originated.