Skip to main content

Posts

Showing posts with the label InitialDirContext ldap

ldap and Java

For those who are starters with LDAP, a good article can be found in Wikipedia .  The LDAP URL is fairly extensible and a sample format is ldap://host:port/DN?Atributes_to_Fetch?range?SearchFilter?extensions hostname is the Fully Qualified (FQDN) or IP address of the LDAP server to search. port is the network port (default port 389) of the LDAP server. DN is the distinguished name to use as the search base. Atributes_to_Fetch is comma-separated. range specifies the search scope and can be "base" (the default), "one" or "sub". SearchFilter is a search critiera. Can accept wild characters too extensions are optional. A sample ldap program in Java import javax.naming.directory.*; import javax.naming.*; import java.util.Vector; import java.util.Enumeration; import java.util.Properties; public class search { public static void main(String[] args) { String base = "cn=generic,ou=MyClient,ou=Applications,ou=Pacific,o=mycompany.net"; String