[Fix] - SQL Server Error : Cannot open database requested by the login.

Wikitechy | 2936 Views | sql server | 05 Jun 2016


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"


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

Fixes are applicable to the following versions of SQL Server:

  • SQL Server 1.1 (16 bit)
  • SQL Server 4.2A (16 bit)
  • SQL Server 4.2B (16 bit)
  • SQL Server 4.21a
  • SQL Server 6.0
  • SQL Server 6.5
  • SQL Server 7.0
  • SQL Server 7.0 OLAP Tools
  • SQL Server 2000
  • SQL Server 2000 64-bit Edition
  • SQL Server 2005
  • SQL Server 2008
  • Azure SQL DB
  • SQL Server 2008 R2
  • SQL Server 2012
  • SQL Server 2014
  • SQL Server 2016

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


Bug Bounty
IOT Hackathon

Join our Community