Home » Blog » Topic » SQL Server error cannot open database requested by the login

SQL Server error cannot open database requested by the login

Lincoln Burrows ~ Modified: February 17th, 2016 ~ ~ 1 Minute Reading

Home Forums SQL Server error cannot open database requested by the login

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1113 Score: 0
    Lincoln Burrows
    Moderator
    16 pts

    I am trying to connect to MS SQL Server database using SQL Authentication, but it fails with this error:

    Cannot open database “DatabaseName” requested by the login. The login failed.
    Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’.

    #1157 Score: 0
    Stephen West
    Moderator
    4 pts

    If you are using Windows authentication, then
    Create a SQL Server log login for NT AUTHORITY\NETWORK SERVICE on your SQL Server
    or
    Change the connection string like this

    connectionString="Servere=.\SQLExpress;Database=IFItest;User ID=UserName;pwd=password"

    #1192 Score: 0
    Andrew Jackson
    Moderator
    1 pt

    This error generally happens when users configured an asp.net application to IIS, and IIS tries to gain access (login) with improper permission.

    To fix this error

    • Open SQL Server Management Studio >> Security >> Logins (right click on the user) >> Properties
    • On Login Properties window, click on User Mapping from the left pane.
    • Under Users Mapped to this login: select the database and from the lower screen (Database role membership for: Database) check db_owner role and click ok
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.