• Accessing ADLDS db through SQL Server

    From Lyle H. Gray@21:1/5 to All on Tue Jul 14 11:17:28 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 error:

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

    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 OPENQUERY(ADSI,
    '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 'person'.

    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tito@21:1/5 to Lyle H. Gray on Fri Jul 31 14:11:53 2020
    The ADSI linked server is created and works when you right click on it and select Test Connection?

    On Tuesday, July 14, 2020 at 9:17:35 AM UTC-7, Lyle H. Gray wrote:
    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 error:

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

    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 OPENQUERY(ADSI,
    '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 'person'.

    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lyle H. Gray@21:1/5 to Tito on Fri Jul 31 18:53:51 2020
    Yes, the linked server works when I use Test Connection.

    Tito <yosiasz@gmail.com> wrote in news:aac2bdb0-df27-4a35-b15d-a1a079e64d21n@googlegroups.com:

    The ADSI linked server is created and works when you right click on it
    and select Test Connection?

    On Tuesday, July 14, 2020 at 9:17:35 AM UTC-7, Lyle H. Gray wrote:
    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 error:

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

    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 OPENQUERY(ADSI,
    '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 'person'.

    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tito@21:1/5 to All on Sat Aug 1 08:58:40 2020
    I believe your error is due to the fact that you might have more than 6 for that specific filter? Are you sure you only have 6 people that match that filter?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lyle H. Gray@21:1/5 to Tito on Sat Aug 1 12:04:15 2020
    Tito <yosiasz@gmail.com> wrote in news:03de176c-c2fb-478e-bff4-57361c4d437an@googlegroups.com:

    I believe your error is due to the fact that you might have more than
    6 for that specific filter? Are you sure you only have 6 people that
    match that filter?

    I am very sure that I only have 6 for that specific filter.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tito@21:1/5 to All on Sat Aug 1 11:57:51 2020
    This is what I have in case it helps

    where objectClass = ''User''
    AND objectCategory = ''Person''
    AND ''userAccountControl:1.2.840.113556.1.4.803:'' <>2 ')

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lyle H. Gray@21:1/5 to Tito on Sat Aug 1 21:11:14 2020
    I'll have to see if this fits into my situation on Monday. Thank you for
    the suggestion.

    Tito <yosiasz@gmail.com> wrote in news:b000045a-5226-4f88-8258-bfc46ab4e1dcn@googlegroups.com:

    This is what I have in case it helps

    where objectClass = ''User''
    AND objectCategory = ''Person''
    AND
    ''userAccountControl:1.2.840.113556.1.4.803:'
    ' <>2 ')

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lyle H. Gray@21:1/5 to Tito on Mon Aug 3 18:57:51 2020
    It doesn't look like this approach makes any difference in my case. I
    still get the [uninformative] error.

    But thanks again for the suggestion.

    Tito <yosiasz@gmail.com> wrote in news:b000045a-5226-4f88-8258-bfc46ab4e1dcn@googlegroups.com:

    This is what I have in case it helps

    where objectClass = ''User''
    AND objectCategory = ''Person''
    AND
    ''userAccountControl:1.2.840.113556.1.4.803:'
    ' <>2 ')

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)