Linked Server to ActiveDirectory

Last Post 22 Sep 2009 07:33 AM by Shafiq. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Shafiq
New Member
New Member

--
18 Sep 2009 08:47 AM
HI,
I am having a problem querying active directory data using linked server

Here is how I created my linked server
EXEC sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces',
'ADSDSOObject', 'adsdatasource'
GO

-- Query used to return data
SELECT * FROM OPENQUERY(ADSI,'SELECT Name,givenName,sn FROM ''LDAP://DC=dcname,DC=com'' WHERE objectCategory = ''Person'' AND objectClass= ''user'' ORDER BY Name')

Error message is attached.
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT Name,givenName,sn FROM 'LDAP://DC=dcname,DC=com' WHERE objectCategory = 'Person' AND objectClass= 'user' ORDER BY Name" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".

I am using SQL Server 2005 SP3. My SQL Service is running under a domain account which has access to active direcotry.

Thanks
Shafiq
Shafiq
New Member
New Member

--
22 Sep 2009 07:33 AM
This issue is resolved. Problem was with the security of the user querying the active direcotry.


Acceptable Use Policy
---