1

I have a visual web part that is calling a database. I’m using a connection string that passes through a SQL account and password to access the DB. This works when trying to access a DB on the same server, but when I try to access a different server I am getting the error

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

The only difference between the two is that the SQL database is located on a different server, so it seems like the credentials aren’t being passed through to the other server.

I’ve had a look online and it’s seems like this is being referred to as the “Double Hop Problem”, but that seems to be related to a windows accounts rather than a SQL Login.

The SQL version is SQL Server 2008. Do I need to specify something in the connection string to pass the credentials through to the other server?

  • May need to use Kerberos? I'm not an expert on Kerberos, so I won't hazard an answer. – Jammin4CO Jul 3 '17 at 17:02
1

I agree with you that the issue is not related to SQL login, I think it may occur because of

The Application pool user account of the SharePopint web application didn't have permission to access the Database.

Solution

  • In the SQL server, Provide the Application pool user account the required permission on your database as Owner.
  • In your Connection String tag,
    • Change the Connection String from SQL authentication to Windows Authentication by removing the userID and Password.
    • And add Integrated Security = true

If the above solution does not help check another thread at Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

  • 1
    This defeats the purpose -- the OP indicated they're attempting to use a SQL login. You've just introduced an issue where by you now do have a double hop scenario due to lack of Kerberos. – Trevor Seward Jul 3 '17 at 22:16
  • 1
    So I mentioned the Kerberos solution at the attached link – Mohamed El-Qassas MVP Jul 3 '17 at 22:29
  • 1
    Understood, but it doesn't solve OPs problem -- namely that SQL auth isn't functional. Keep in mind that not all types of SQL servers have WIA. – Trevor Seward Jul 3 '17 at 22:30
  • Yes unfortunately we were attempting to use SQL authentication to keep things consistent as this is the account we use for SSRS reports as well. This is a corporate environment and I may not be allowed use the app pool account. – user2096185 Jul 4 '17 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.