| Contents

# Directory Operations

> You can use the JNDI to perform directory operations, including the following:
> - Reading an object's attributes
> - Modifying an object's attributes
> - Searching the directory
> - Performing hybrid naming and directory operations
> This lesson describes each of these operations. Before using any of them, you should read the section on the use of attribute names that apply to all of these operations.

> #### Configuration

> The examples in this lesson use the LDAP service provider. They assume that you have set up a sample namespace using the content described in the Preparations lesson. If you use another service provider or choose to use another part of the LDAP namespace, then the behavior will differ from what is shown here.

> The initial context used in these examples is initialized using the following environment properties.

> >     // Set up the environment for creating the initial context
> >     Hashtable env = new Hashtable();
> >     env.put(Context.INITIAL_CONTEXT_FACTORY,
> >         "com.sun.jndi.ldap.LdapCtxFactory");
> >     env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");
> >     DirContext ctx = new InitialDirContext(env);

| Contents