Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LDAP query via vbscript and iPlanet

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
I have only created one LDAP class retrieving info from Active Directory. We have installed iPlanet on its own server and I need to know the syntax for accessing LDAP.

LDAP Configuration:

Host: MyHost
Port: 477
Agent Port: 4000

Root: ou=abc,dc=ad,dc=mhkk,dc=com
User: cn=Dir Mgr
Password: MyPassword

Administration Port: 12345

The following code produces the error "Can't find table". What am I doing wrong?
Code:
Sub GetDisplayName()

	Dim conn
	Dim com
	Dim oRecordset

	'*******************************
	'*  Open the connection to AD  *
	'*******************************

	Set conn = CreateObject("ADODB.Connection")
	conn.Provider = "ADsDSOObject"
	conn.Properties("User ID") = "Dir Mgr"
	conn.Properties("Password") = "MyPassword"

	conn.Open "LDAP Provider"

	Set com = CreateObject("ADODB.Command")
	com.ActiveConnection = conn

	com.CommandText = "SELECT  displayName FROM 'LDAP://MyHost:477/OU=abc,DC=ad,DC=mhkk,DC=com'"

	oRecordset = com.Execute

end sub
 
prima facie
>com.ActiveConnection = conn
[tt][red]set[/red] com.ActiveConnection = conn[/tt]
>oRecordset = com.Execute
[tt][red]set[/red] oRecordset = com.Execute[/tt]
 
tsuji, that didn't seem to help. I think the problem is with the provider. Since the LDAP is not configured as Active Directory I'm not sure how to specify the provider.

Note: The following works (if that helps you in figuring out what I'm doing wrong). I prefer to do get the code in my original post to work.
Code:
    Set ons = GetObject("LDAP:")

        Set ocontainer = ons.OpenDSObject("LDAP://MyHost:477/ou=users,ou=abc,dc=ad,dc=mhkk,dc=com", "cn=username", "mypassword", &H1 And &H200)
 
Look, I am not going to argue anything. Those two lines I make are going to stay as long as you're doing that approach. They may not be the only problems to get thing done, but without them corrected nothing will work. That's the bottom line and to me not open to negotiation with the machine. Good luck!
 
What??? I did what you said. And it will work as long as LDAP is configured as Active Directory. But in this case, LDAP is not configured as an Active Directory. That's why I figured the provider was incorrect.
 
It works. I had the user id incorrect (typo). (Several hours waisted...But I'm new to LDAP) I thought that since it was not an Active Directory LDAP that the provider ADsDSOObject was incorrect. Sorry 'bout that.

Anyway, now I have another problem. I added a Where clause to the Select statement, and it timesout in less than 30 seconds. I have set the commandTimeout and connectionTimeout both to 90. But still no luck. In the debug watch window the value for oRecordset says "Unable to evaluate expression. The expression evaluation took too long". If I type something into the watch window, then oRecordset contains what it is supposed to.

How do I get around the timeout problem?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top