Home All Groups Group Topic Archive Search About

cannot query directory services

Author
22 Sep 2006 5:40 AM
Job
Dear all,

I would like to query informations that are located in the (AD) Active
Directory Windows 2003 with my server Windows 2000SP4 and MS SQL 2000 SP4 in
the same domain and AD.
I create the link server with the following script :

EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
'ADSDSOObject', 'adsdatasource'
GO

and I query AD with the following :

SELECT [Name], SN [Last Name], ST State
FROM OPENQUERY( ADSI,
   'SELECT Name, SN, ST
   FROM ''LDAP://ADSISrv/ OU=myOU,DC=mycompagny,DC=com''
   WHERE objectCategory = ''Person'' AND
      objectClass = ''contact''')
GO

Then I get the following error :

Server: Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing a query for execution against OLE DB
provider 'ADSDSOObject'.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare
returned 0x80040e14].

I clarify that I used Integrated Windows security and also used the USERID
and password of service SQLserver as recommanded to launch my query.
But I get the above error. Why ?
Thanks for your next reply,
Job

Author
22 Sep 2006 7:50 AM
John Bell
Hi

You may get a better response in the ADSI news groups e.g
microsoft.public.adsi.general, but I think the error is probably because the
syntax of your query is incorrect, check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/adsi_ldap_provider.asp

John


Show quoteHide quote
"Job" wrote:

> Dear all,
>
> I would like to query informations that are located in the (AD) Active
> Directory Windows 2003 with my server Windows 2000SP4 and MS SQL 2000 SP4 in
> the same domain and AD.
> I create the link server with the following script :
>
> EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
> 'ADSDSOObject', 'adsdatasource'
> GO
>
> and I query AD with the following :
>
> SELECT [Name], SN [Last Name], ST State
> FROM OPENQUERY( ADSI,
>    'SELECT Name, SN, ST
>    FROM ''LDAP://ADSISrv/ OU=myOU,DC=mycompagny,DC=com''
>    WHERE objectCategory = ''Person'' AND
>       objectClass = ''contact''')
> GO
>
> Then I get the following error :
>
> Server: Msg 7321, Level 16, State 2, Line 1
> An error occurred while preparing a query for execution against OLE DB
> provider 'ADSDSOObject'.
> OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare
> returned 0x80040e14].
>
> I clarify that I used Integrated Windows security and also used the USERID
> and password of service SQLserver as recommanded to launch my query.
> But I get the above error. Why ?
> Thanks for your next reply,
> Job
>
>
>

Bookmark and Share

Post Thread options