Connection to Active directory from SQL server

  • Hi,

    I am new to SQL server 2005. I am trying to get some user data from Active directory using linked server and LDAP query.

    I did the following:

    Used this statement for creating a new linked server:

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

    I am not sure about the parameters that i am passing to this SP. Should I give the server name too which is rwdc

    After I execute the above SP I can see a new linked server added in the object explorer.

    Then I executed the following SQL ldap query:

    SELECT * FROM OpenQuery(ADSI, 'SELECT * FROM "LDAP://OU=Users,DC=mycompany,DC=com" ')

    As soon as I execute it the following error shows up:

    Msg 7321, Level 16, State 2, Line 1

    An error occurred while preparing the query "SELECT * FROM "LDAP://OU=Users,DC=mycompany

    ,DC=com" " for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".

    Could any body help me to figure where the problem is.

    I have a readonly access to the AD.

    Also should edit any properties of the created linked server from the editor window.

    Thank you.

  • I did a Google search for this, and found a couple of good resources on the subject. I'm not sure which one would help you the most, but you can do the search and pick out what you need yourself pretty easily.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 2 posts - 1 through 1 (of 1 total)

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