Adding an Entry

You can add new entries to the directory by defining a DN for the entry, creating the attributes for the entry, and requesting that the LDAP server add the new entry.

Summary of Steps to Add a New Entry

Creating an entry in the directory requires the following steps:

1.
Instantiate an LDAPAttribute object for each attribute that forms the entry.
2.
Instantiate an LDAPAttributeSet object and use the add method to add each LDAPAttribute object from step 1.
3.
Instantiate an LDAPEntry object that specifies the new DN and the LDAPAttributeSet from step 2.
4.
Call the LDAPConnection.add method with the LDAPEntry object from step 3.

The LDAPAttribute class represents an attribute. An LDAPAttribute is used to build each attribute ...

Get LDAP Programming with Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.