Download the JDK
Search the Tutorials
Hide the TOC
Trail: Java Naming and Directory Interface(TM).
Lesson: Naming and Directory Operations
Naming and Directory Operations
Naming Exceptions
Lookup an Object
List the Context
Add, Replace or Remove a Binding
Rename
Create and Destroy Subcontexts
Attribute Names
Read Attributes
Modify Attributes
Add, Replace Bindings with Attributes
Search
Basic Search
Filters
Scope
Result Count
Time Limit
Trouble Shooting Tips
Home Page > Java Naming and Directory Interface(TM). > Naming and Directory Operations
« Previous • Trail • Next »
Rename

> You can rename an object in a context by using `Context.rename()`.

> >     // Rename to Scott S
> >     ctx.rename("cn=Scott Seligman", "cn=Scott S");

> This example renames the object that was bound to `"cn=Scott Seligman"` to `"cn=Scott S"`. After verifying that the object got renamed, the program renames it to its original name (`"cn=Scott Seligman"`), as follows.

> >     // Rename back to Scott Seligman
> >     ctx.rename("cn=Scott S", "cn=Scott Seligman");

> For more examples on renaming of LDAP entries check out the Advanced Topics for LDAP users lesson.

« Previous • Trail • Next »
Previous page: Add, Replace or Remove a Binding
Next page: Create and Destroy Subcontexts