locked
ldap query RRS feed

  • Question

  • i am trying acess the active directory when i use the query below:

    SELECT  Name, displayName,givenname,distinguishedName, SAMAccountName

    FROM
    OPENROWSET('ADSDSOObject','adsdatasource'; 'username/password',
    'SELECT   Name, displayName,givenname,distinguishedName, SAMAccountName

        FROM ''LDAP://afrcdc01.reserves.afrc.ds.af.mil/OU=Users,OU=A6 (SC),OU=HQ AFRC,DC=reserves,DC=afrc,DC=ds,DC=af,DC=mil'' ')
    go

    i can get some data.  however if i change the query to:

    SELECT  Name, displayName,givenname,distinguishedName, SAMAccountName

    FROM
    OPENROWSET('ADSDSOObject','adsdatasource'; 'username/password',
    'SELECT   Name, displayName,givenname,distinguishedName, SAMAccountName

        FROM ''LDAP://afrcdc01.reserves.afrc.ds.af.mil/OU=Users,DC=ds,DC=af,DC=mil'' ')
    go

    i get this error

    Msg 7321, Level 16, State 2, Line 1
    An error occurred while preparing the query "SELECT   Name, displayName,givenname,distinguishedName, SAMAccountName

        FROM 'LDAP://afrcdc01.reserves.afrc.ds.af.mil/OU=Users,DC=ds,DC=af,DC=mil' " for execution against OLE DB provider "ADSDSOObject" for linked server "(null)".

    i had previously did these steps:

    USE [master]
    GO
    sp_configure 'show advanced options',1
    GO
    reconfigure with override
    GO
    sp_configure 'Ad Hoc Distributed Queries',1
    GO
    reconfigure with override
    GO

    i have been trying to research this for about a week now and am having no luck.  i am not using this as a last resort but i like to try and figure things out on my own first before i bother you folks.  if anyone can help me i would really appreciate any assistance you might be able to provide.

    lonnie

    • Moved by Bob Beauchemin Monday, May 17, 2010 7:16 PM Moved to a more relevent forum (From:.NET Framework inside SQL Server)
    Monday, May 17, 2010 6:03 PM

Answers

  • Hi Lonnie,

     

    Generally, based on domain logical achievements and features, ds.af.mil should not contain objects. This means

    "LDAP://afrcdc01.reserves.afrc.ds.af.mil/OU=Users,DC=ds,DC=af,DC=mil" is not valid path.

     

    To verify the issue, we can try to connect to connect to ds.af.mil using Active Directory Explorer. We may not able to connect to it due to the cause we described before.

     

    I would suggest you using Active Directory Explorer to get the valid LDAP path.

     

    Active Directory Explorer can be downloaded from:

    http://technet.microsoft.com/en-us/sysinternals/bb963907.aspx

     

    Besides, I would suggest you re-posting the question in Windows Server forum, you will get more information about the LDAP path from there:

    http://social.technet.microsoft.com/Forums/en-US/category/windowsserver

     

    If you have any more questions about SQL Server, please feel free to ask.

     

    Thanks,

    Ai-hua Qiu

    Wednesday, May 19, 2010 5:06 AM

All replies

  • Hi Lonnie,

     

    Generally, based on domain logical achievements and features, ds.af.mil should not contain objects. This means

    "LDAP://afrcdc01.reserves.afrc.ds.af.mil/OU=Users,DC=ds,DC=af,DC=mil" is not valid path.

     

    To verify the issue, we can try to connect to connect to ds.af.mil using Active Directory Explorer. We may not able to connect to it due to the cause we described before.

     

    I would suggest you using Active Directory Explorer to get the valid LDAP path.

     

    Active Directory Explorer can be downloaded from:

    http://technet.microsoft.com/en-us/sysinternals/bb963907.aspx

     

    Besides, I would suggest you re-posting the question in Windows Server forum, you will get more information about the LDAP path from there:

    http://social.technet.microsoft.com/Forums/en-US/category/windowsserver

     

    If you have any more questions about SQL Server, please feel free to ask.

     

    Thanks,

    Ai-hua Qiu

    Wednesday, May 19, 2010 5:06 AM
  • very good information 

    Wednesday, May 19, 2010 7:24 AM