Login failed for user 'NT AUTHORITY\SYSTEM' in SQL EXPRESS 2005

  • I have developed the windows service & in windows service used the SQL server database .

    when i will start the computer my windows service get started but it will not connect to the SQL server .it display the following message

    "Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITY\SYSTEM'."

    I want to start my service when my computer starting.

    how to establish the connection to SQL server database from windows service when starting the computer ?

  • Are you able to log on to SQL Server using the sa account and verify that NT AUTHORITY\SYSTEM has an associated login and what is the default database for the account.

  • I have default login of the windows mode (local system account)

  • I have default login of the windows mode (local system account)

  • Right click this login in SQL Server Management Studio, select properties and at the bottom of the dialog and tell me what the default database is.

  • default database is master

  • Hmm, okay, need to get the context nailed down:

    Is the SQL Server using mixed mode, or Windows authentication?

    Is the SQL Service running?

    What are you attempting to do when you get the error?

    Where are you finding the error?

  • Is the SQL Server using mixed mode, or Windows authentication?

    Windows authentication

    Is the SQL Service running?

    yes

    What are you attempting to do when you get the error?

    i have used the SQL server database connection into the windows service (created windows service in C#.NET). All windows service started after computer started or restarted. After starting or restarting the computer my windows service started & at the time of reading the data from the database ,it displays the message as

    "Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITY\SYSTEM'".

    Where are you finding the error?

    when I have read the data from the database it will thrown an exception in message box

  • This could be a problem with the connection string - check it carefully for typos 🙂

  • my connection string

    Data Source = .\\SQLEXPRESS; AttachDbFileName= path\\datbasename.mdf;Connect Timeout=1000;Trusted_Connection=True

  • The connection string is the string used to connect to SQL server. It will be in the C# project and should contain servername, username, security info etc...

    It would be also be interesting ot have a look at the login errors being written into the SQL Server error logs.

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply