Accessing ADLDS db through SQL Server

Giganews Newsgroups
Subject: Accessing ADLDS db through SQL Server
Posted by:  Lyle H. Gray (
Date: Tue, 14 Jul 2020

I have an Active Directory (LDAP) database, specifically AD LDS, that
stores information for a webserver on the same host. I have been attempting
to access this server through Transact-SQL, but am currently blocked by the

Msg 7330, Level 16, State 2, Line 3
Cannot fetch a row from OLE DB provider "ADSDSOObject" for linked server

Note that this is not an AD database to store typical user information for
authentication, and that it does not have a DC entry at the top level; it
uses "O=[orgname],C=US" at the top level instead for the connection that
I'm trying to query.

I have a Linked Server defined with the name "ADSI" using the ADSDSOObject
provider, and have tried using the following query to attempt to retrieve
information from the AD database:

'SELECT name FROM ''LDAP://localhost:389/O=[orgname],C=US''
WHERE objectClass = ''person''')
AS ldap_qry ;
In this particular database, there are only 6 entries with objectClass of

I'm using the current login's security context, which should have access to
the database (and I do not get an error related to permissions). If I
switch to an AD database that is used for authentication (and uses DC=
[orgname],DC=net), I am able to access the information.

The error message is not particularly useful, and all of the information
that I've found on this particular error reference the limit on how many
rows can be returned (which is a lot higher than 6 rows).

Does anyone have any suggestions?