olivierv75
-
Total Posts
:
3
- Scores: 0
-
Reward points
:
0
- Joined: 1/2/2012
- Location: Paris
-
Status: offline
|
Connection to OpenLDAP server with a ADODB connection
Monday, January 02, 2012 10:58 PM
( permalink)
Hello, I would like to set up a VBScript that will retrieve the information stored on an OpenLDAP server but I have some problems with the initialization of the connection, or rather the RecordSet object. Can anyone tell me what's wrong in my script which appears below? strUserLDAP = "cn=user,ou=connectors,dc=domain,dc=us" strLDAPPassword = "ldapPassword" sBaseDN = "LDAP://ldap.domaine.us:389/ou=groups,dc=domain,dc=us" Set oConnection = CreateObject("ADODB.Connection") oConnection.Provider = "ADsDSOObject" oConnection.Properties("User ID") = strUserLDAP oConnection.Properties("Password") = strLDAPPassword oConnection.Properties("Encrypt Password") = false oConnection.Open "ADs Provider", strUserLDAP, strLDAPPassword Set oCommand = CreateObject("ADODB.Command") oCommand.ActiveConnection = oConnexion sLDAPQuery = "<"& sBaseDN &">" 'sLDAPFilter = "(objectClass=*)" sAttribut = "dn" sLDAPQuery = sLDAPQuery & ";" & sLDAPFilter & ";" & sAttribut & ";onelevel" oCommand.CommandText = sLDAPQuery On Error Resume Next Set oRecordSet = oCommand.Execute If Err <> 0 Then MsgBox "Impossible to get result !" & vbcrlf & "Description error:" & Err.description WScript.Quit Else MsgBox "It's all right" End If Thanks for your help
<message edited by olivierv75 on Tuesday, January 03, 2012 4:10 AM>
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Connection to OpenLDAP server with a ADODB connection
Tuesday, January 03, 2012 3:22 AM
( permalink)
What error do you get? If you are not getting an error, remove the On Error Resume next and see what error you get. Which specific line is causing the error?
|
|
|
|
olivierv75
-
Total Posts
:
3
- Scores: 0
-
Reward points
:
0
- Joined: 1/2/2012
- Location: Paris
-
Status: offline
|
Re:Connection to OpenLDAP server with a ADODB connection
Tuesday, January 03, 2012 3:41 AM
( permalink)
Hello ebgreen, The problem seems to occur at the line "Set oRecordSet oCommand.Execute =" ; when I create a Recordset object. The dialog box displays the following information: Error: Error not specified Code: 80004005 Source: Provider An idea ?
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Connection to OpenLDAP server with a ADODB connection
Tuesday, January 03, 2012 4:03 AM
( permalink)
The first thing that I see is: sLDAPQuery = sRequeteLDAP & ";" & sLDAPFilter & ";" & sAttribut & ";onelevel" but I don't see anywhere that you define sRequeteLDAP
|
|
|
|
olivierv75
-
Total Posts
:
3
- Scores: 0
-
Reward points
:
0
- Joined: 1/2/2012
- Location: Paris
-
Status: offline
|
Re:Connection to OpenLDAP server with a ADODB connection
Tuesday, January 03, 2012 4:12 AM
( permalink)
It's actually a mistake when I wanted to translate French programm in a English program. I forgot to replace all the iterations sRequeteLDAP by sLDAPQuery. In my original program (in French) all variables are defined. I also corrected the script that appears in my first message
<message edited by olivierv75 on Tuesday, January 03, 2012 5:21 AM>
|
|
|
|