java2db

Update or edit entry in OpenLdap with java JNDI



It’s quite simple to update or edit entry in OpenLdap with java. JNDI is a standard interface to add,delete,search and modify entries .

Requirements to Update or edit entry in OpenLdap  :

Update or edit entry in OpenLdapSoftware requirement:

……Update or edit entry in OpenLdap OpenLDAP (Download OpenLDAP).

……Update or edit entry in OpenLdap Java  (Download Java).

Update or edit entry in OpenLdapAuthentication requirement :

……Connect to the OpenLdap OpenLDAP  IP and PORT .

……Connect to the OpenLdap Login DN , Password .

Update or edit entry in OpenLdap

From the above example diagram , we are going to modify the entry uid=1231 . See the example code below.

Example to Update or edit entry in OpenLdap :

Execution Result:

Update or edit entry in OpenLdap Connect to the OpenLdap server with valid credentials(line number 17 to 29).

Connect to the OpenLdap “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: 10.180.9.21)  and port (Ex:389).
Connect to the OpenLdap Connection type is “simple” ,that means, it will take the plain text as a password .
Connect to the OpenLdap cn=manager,dc=maxcrc,dc=com” is the  distinguished name (It is the default DN).
  Line num 44 , we are creating a BasicAttribute object with  value (java2db@mail.com) to update

……..the mail.
modifyAttributes(name,constant,attrs) method will take three arguments.
……..i) name : uid=1231,ou=People,dc=maxcrc,dc=com (Entry name to update + container name).
……..ii) constant : DirContext.REPLACE_ATTRIBUTE (The value is 2 for update).
……..iii) Attributes object : atbs (With BasicAttribute objects).
  It throws entry not found exception if the id does not exist in the specified DN.




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
Add new entry in OpenLdap using 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]



^ <