returns a NamingEnumeration of people : Context « J2EE Application « Java Tutorial

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.NamingEnumeration;

public class FilterExample {
  public static void main(String[] argc) throws Exception {
    Hashtable env = new Hashtable(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap://MyHost/o=JNDIExample");

    DirContext dctx = new InitialDirContext(env);

    String filter = "(&(cn=E*)(account>1005))";

    NamingEnumeration result ="ou=People", filter, null);

    while (result.hasMore()) {
      SearchResult sr = (SearchResult);
      System.out.println("Result = " + sr.getName());


32.3.1.Create Context
32.3.2.Access a specific object by using the lookup or lookupLink methods
32.3.3.Deleting an Object Binding
32.3.4.Renaming and Moving an Object
32.3.5.Replacing and Adding Objects
32.3.6.Bind class.
32.3.7.Using a search result, you could you could use the following program to print the results:
32.3.8.returns a NamingEnumeration of people
32.3.9.Search Filter Symbols