Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Linked Server Error with Domain Admin

Author  Topic 

bholmstrom
Yak Posting Veteran

76 Posts

Posted - 2013-04-03 : 13:38:16
I am getting this error when querying the Active Directory

Msg 7321, Level 16, State 2, Line 27
An error occurred while preparing the query "SELECT DisplayName, title,mail
FROM 'LDAP://CBC-03/DC=jhcohn,DC=com'
WHERE objectClass = 'Person'
" for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI".

I am not the DOmain Admin, but the lady that is gets the same error.

Here is the Code that linked the server:

EXEC master.dbo.sp_addlinkedserver @server = N'ADSI',
@srvproduct=N'Active Directory Services', @provider=N'ADsDSOObject',
@datasrc=N'cbc-03.jhcohn.com' --AKA the full computer name of the AD server

Here is the query code:

SELECT * FROM OpenQuery
(
ADSI,
'SELECT DisplayName, title,mail
FROM ''LDAP://CBC-03/DC=jhcohn,DC=com''
WHERE objectClass = ''Person''
')

Any ideas, thanks in advance

Bryan Holmstrom

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-04-03 : 14:59:29
what sql server version are you running?

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2013-04-03 : 15:47:06
Might want to look at this thread
Go to Top of Page
   

- Advertisement -