Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Location
    Norway
    Posts
    2

    Unhappy Unanswered: query a LDAP server from MS SQL

    I try to connect to a LDAP server from SQL query analyzer with the following string

    (SELECT * FROM OPENQUERY
    (ADSI,'SELECT * FROM ''LDAP://DC=test-02,DC=test,CD=no'' '))

    This resulted in a error meesage:

    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 [Non-interface error: OLE DB provider ADSDSOObject returned DBPROP_STRUCTUREDSTORAGE without DBPROPVAL_OO_BLOB being supported].
    OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare returned 0x80040e14].

    What is the problem ? It is something wrong with my db-setup, the query or what ? I try to do the same thing in a VB-program and that worked fine.

  2. #2
    Join Date
    Oct 2001
    Location
    Naples, FL
    Posts
    273
    Did you setup the linked server?

    exec sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces', 'ADSDSOObject', 'adsdatasource'

    instead of select * try and name them to see if you can at least return something

    SELECT [Name],SN[Last Name]
    FROM OPENQUERY( ADSI,
    'SELECT Name,SN FROM ''LDAP://DC=test-02,DC=test,CD=no'' ')

    also, if objects are in containers you can specify the container name by CN= or if in OU's - OU=

    if you are only wanting users you can specify

    WHERE objectCategory = ''Person'' AND objectClass = ''user''

    HTH
    ---------------
    Ray Higdon MCSE, MCDBA, CCNA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •