I've been trying to follow along with the example on these pages for querying Active Directory from a linked server in SQL Server 2005.
I used this link to create the linked server and the linked server login:
Then I tried to use one of the sample queries on this page (based on seeing the link in another SSC post):
The linked server and linked server login creation appears to succeed, and when I right-click on the linked server and choose Test Connection, it says "The test connection to the linked server succeeded."
One problem with that is that the connection test succeeds even when I change the linked server login password to something wrong. So something is not checking the credentials correctly.
And when I try to run an example query, I get this error:
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "
" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".
(I omitted the query text for now, since it doesn't seem relevant yet.)
I admit that I am new to Active Directory, so I'm not sure if I am constructing the LDAP URLs correctly or whether I'm getting all of that wrong and also not properly understanding how to refer to accounts within the AD hierarchy.
But I'm wondering if there is a step-by-step introduction to how AD implements LDAP, especially:
1. how to link to and successfully query an AD directory from SQL Server
2. how to reference fields and groups in SQL queries against an AD linked server to get the right information
3. what errors such as 7321 indicate
I'm pretty much flying blind at this point and would be grateful if anyone could point me in the right direction to learn more.
Thanks in advance for any help!
"I love spending twice as long and working twice as hard to get half as much done!" – Nobody ever.
"Operator! Give me the number for 911!" - Homer Simpson
"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'"