I am creating a windom in our application that will allow our secretary to look up employee contact info using LDAP. So far I’m in the testing phase and here is the code I have behind a button:
[color=#0080BF]from java.util import *
from javax.naming import *
from javax.naming.directory import *
import java.util.Hashtable
import java.util.Enumeration
import javax.naming
import javax.naming.directory
env = Hashtable()
env.put(Context.INITIAL_CONTEXT_FACTORY, “com.sun.jndi.ldap.LdapCtxFactory”)
env.put(Context.PROVIDER_URL, “ldap://10.10.10.9:389”)
env.put(Context.SECURITY_AUTHENTICATION, “none”)
env.put(Context.SECURITY_PRINCIPAL, “cn=user@schn.com”)
env.put(Context.SECURITY_CREDENTIALS, “password”)
ctx = InitialDirContext(env)
#Define Search Options
constraints = SearchControls()
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE)
#Specify search options
results=ctx.search(“o=schn.com”,“objectclass=user”,constraints)
entry = results.next()
print str(entry.getName())[/color]
And attached is the error code I get when I run the script. Any ideas?