Share via

Linked server error

Pol 86 Reputation points
2023-09-02T19:30:31.47+00:00

Hi,

I created the Linked server in ServerA using the command :

EXEC sp_addlinkedserver

@server=N'TestLink',

@srvproduct=N'',

@provider=N'MSOLEDBSQL',

@datasrc=N'ServerB;

I am able to get the output using through linked server query - select * from TestLink.xyz.dbo.table1 in ServerA

But when ever i am trying to query from remote server ServerC i am getting below output.

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

Please help me how to resolve the error?

Thanks,

Jo

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


1 answer

Sort by: Most helpful
  1. Erland Sommarskog 134.7K Reputation points MVP Volunteer Moderator
    2023-09-02T19:51:55.9066667+00:00

    This is the famous double-hop issue. That is, when you connect from ServerA from ServerC, ServerA must be able to send your security token to ServerB. For this work, you need to have Kerberos running and SPNs in place. If you are in a workgroup and not a domain, it is unlikely that you can get it to work at all.

    As a starting point, when you connect from ServerC, run this query:

    SELECT auth_scheme FROM sys.dm_exec_connections WHERE session_id = @@spid
    

    If it says KERBEROS, that's at least a start. If it says NTLM, that's the first thing to you need to change.

    I'm not very good at this stuff myself, but I have found that David Postlewaite's presentations has helped me to understand a little bit. You can watch him on YouTube here: https://www.youtube.com/watch?v=oY9-qctTMwQ

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.