[Fix] - ERROR Cannot open database requested by the login.
Error :
- error: Cannot open database requested by the login. The login failed. Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’.
Scenario :
- This error occurs when the application is configured with IIS, and IIS contact SQL Server to login with credentials that has no proper permissions. The error can also occur during replication or mirroring.
Fix 1 :
- Use SQL server authentication mode with the “NT AUTHORITY\NETWORK SERVICE” user that has “sysadmin”, “public” server roles.
has a user mapping with the intended DB along with “db_owner” role as follows:
Fix 2 :
- When there is a LAN connection between the server and the client, use the below connection string.
"Data Source=[Server_name\User_name]; Initial Catalog=[DB_name]; Integrated Security=True; Connect Timeout=30; User Instance=True"
(or)
"Data Source=[Server_name\User_name\SQLExpress]; Initial Catalog=[DB_name]; Integrated Security=True;Connect Timeout=30;User Instance=True"
Instead of Server_name the IP Address can be used.
Applies to sqlserver version :
- SQL Server 7.0 OLAP Tools
- SQL Server 2000 64-bit Edition
Related Error Tags:
- c# - Cannot open database "" requested by the login. The login failed
- LocalDB cannot open database requested by login. Login failed
- “Cannot open database '…' requested by the login. The login failed”
- asp.net - Login failed for user NT AUTHORITY\NETWORK SERVICE.
- SQL Server Login error: Login failed for user NT AUTHORITY\SYSTEM.
- FIX : ERROR : Cannot open database requested by the login.
- Cannot open database requested by the login. The login failed.
- Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
- cannot open database requested by the login the login failed sql server 2008.