Add new entry in OpenLdap using java JNDI

Use the  createSubcontext  method from Java Naming and Directory Interface (JNDI) to add new entry in OpenLdap .


Requirements to add new entry in OpenLdap  :

Add new entry in OpenLdapSoftwares:

……Add new entry in OpenLdap OpenLDAP (Download OpenLDAP).

…… Java  (Download Java).

Authentication requirement :

…… OpenLDAP  IP and PORT .

…… Login DN , Password .

Connect to the OpenLdap Connect to the OpenLDAP server with ID  and Password .

Create  Distinguished Name(DN) to add a new entry.

…….EX : If you try to add a new entry like uid=1122  in ou= People directory, then the DN will be uid=1122,ou=People,dc=maxcrc,dc=com .
Add the required attribute values ,object class to a Map or a Properties .


Example to add new entry in OpenLdap:

Execution Result:

From the above example code :

 “ldap://localhost:389” is the Ip(ldap://localhost) and port(389) of  the OpenLDAP server.If the

…….server resides remotely ,provide the exact IP (Ex:  and port (Ex:389).
Connection type is “simple” ,that means, it will take the plain text as a password .
cn=manager,dc=maxcrc,dc=com” is the  distinguished name (It is the default DN).
The password is “password“.(That had given at OpenLdap installation).
 Add all the above values to a HashTable or Properties , pass it to InitialDirContext method.

 uid=1122,ou=People,dc=maxcrc,dc=com is the new entry DN (that we are going to be add).

Add new entry in OpenLdap Once connected with the  OpenLDAP , call  createSubcontext  method to create new entry .


Related Posts :
Delete entry from OpenLdap with java JNDI
Search or select all entries from OpenLdap specific dir with java JNDI
Search or select entry from OpenLdap with java JNDI
Update or edit entry in OpenLdap with java JNDI
Connect to the OpenLdap with java JNDI
Select more than one entry from LDAP directory using java JNDI
Select an entry from LDAP using java JNDI
Update or modify LDAP entry using java JNDI
   [will not be published]

^ <