Query LDAP server from SQL server

  • Hi all,

    I am asked to use SQL server to query attributes from LDAP server. I did some research in this forum and found some useful example. However, I still got error. I suspect the root cause is the authentication since I didn't know where should I put the BindDN string (which is the my credential for logging in the ldap)

    Please help me. I am new to SQL server.:(

    Kelvin

  • Hi all,

    I recently use linux to ldapsearch the AD. Is it possible for me to connect the AD from SQL server if I have the following information? If possible, where should I place them in the query??

    1.) LDAP host Name

    2.) Bind DN

    3.) Password

    4.) Search base

    Regards,

    Kelvin

  • Anyone can help on this topic? I have no direction to deal with it...

  • kelvin this may or may not be much help;

    i have this saved in my snippets for creating a linked server to Active Directory, and then querying it...in my case, i didn't have permissions with my domain\username to be able to accomplish this.

    --doesn't quite work...permissions

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

    select * from openquery

    (ADSI,'SELECT cn, mail, co, distinguishedName, displayName

    FROM ''LDAP://disney''

    where objectClass = ''ourdomain\lowell'' '

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Kelvin, you didn't say if you were using AD or some other version of LDAP. I have had very little progress trying to query a linked server to a non-MS LDAP server.

    I finally resorted to scripting out some VB to query LDAP and dump the results into a text file, then using SSIS on an Agent job to import the text file into SQL Server tables. This runs periodically, so it's unfortunately not real-time, but it meets (most of) our needs....:ermm:

    If anyone replies with "here's how we did it, works great" I'll be grateful.

    Good luck,

    Rich

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply