none
linked server ldap RRS feed

  • Domanda

  • Ciao a tutti

    Ho una connessione verso un server LDAP di questo tipo

    cn.Open "Active Directory Provider", "uid=admin,CN=XXX,CN=Application,O=myCompany", "password"

    interrogo il server LDAP con una routine tipo questa che funziona

    Dim cn As New ADODB.Connection
    Dim cmd As New ADODB.Command
    Dim rs As ADODB.Recordset
    Dim sFilter As String
    Dim sADsPath As String
    Dim sDepth As String
    Dim sAttribsToReturn As String
    
     
    
    sDepth = "subTree"
    sADsPath = "<LDAP://10.55.212.110:389/o=myCompany>"
    cn.Provider = "ADsDSOObject"
    cn.Open "Active Directory Provider", "uid=admin,CN=XXX,CN=Application,O=myCompany", "password"
    Set cmd.ActiveConnection = cn
    
    sFilter = "(&(Name=" & "12345678" & "))"
    sAttribsToReturn = "Name,sn,givenName,mail"
    cmd.CommandText = sADsPath & ";" & sFilter & ";" & sAttribsToReturn & ";" & sDepth
    Set rs = cmd.Execute
    Debug.Print rs(3).Value
    
    rs.Close
    Set rs = Nothing
    Set cmd = Nothing
    cn.Close
    Set cn = Nothing

    come faccio a creare un linked server con questo tipo di connessione?

    io ho provato a fare così

    EXEC master.dbo.sp_addlinkedserver @server = N'AAAA', @srvproduct=N'Active Directory Service Interfaces', @provider=N'ADSDSOObject', @datasrc=N'adsdatasource'

    EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'AAAA',@useself=N'False',@locallogin=NULL,@rmtuser=N'admin,CN=XXX,CN=Application,O=myCompany',@rmtpassword='########'

    ma poi quando faccio la query

    SELECT  top 801 * FROM OpenQuery ( 
      AAAA,  
      'SELECT   sn,department
       FROM  ''LDAP://10.55.212.110:389/OU=Dipendenti,OU=myCompany,O=myCompany'' 
      WHERE objectClass =  ''User'' and objectcategory = ''Person''
      ') AS tblADSI 
      where department is not null

    ricevo un messaggio di errore

    The OLE DB provider "ADSDSOObject" for linked server "AAAA" reported an error.
    The provider indicates that the user did not have the permission to perform the operation.

    Grazie a tutti


    venerdì 28 luglio 2017 14:38

Tutte le risposte