java2db

Select an entry from LDAP using java JNDI



To Select an entry from LDAP,first prepare a distinguished name (DN), to search in the LDAP tree .

Basic requirements for authentication :

Select an entry from LDAP IP address and port of the LDAP server.

Select an entry from LDAP LDAP Admin DN and password.

 

Select an entry from LDAP

LDAP-Directory

 

Process to search or select an entry from LDAP  :

Add new entry to LDAP First connect to the LDAP server  .

Add new entry to LDAP prepare user DN  to search .

……..Example: If you want to select the entry uid=142  in  ou=physics directory,then the  DN will be  ……..uid=145,ou=physics,dc=sciencedep,dc=college .

Add new entry to LDAP  Set the search filter. Example : (uid=142)

 

Example to select an entry from LDAP:

Execution Result:

From the above example :

  ldaps://10.160.2.11:1500  is the LDAP server url (IP and Port).

Add new entry to LDAP  Connection type is “simple” ,that means  it will take the plain text as password for authentication.

Add new entry to LDAP  cn=LDAP Administrator,dc=college,dc=org,dc=in  is the Administrator DN .

Add new entry to LDAP uid=142,ou=alzebra,dc=mathsdep,dc=college,dc=org,dc=in  is the DN to search.

Add new entry to LDAP (uid=” +userId+ “)  search filter .

Add new entry to LDAP SearchControls.SUBTREE_SCOPE  Bounds the search to the subtree rooted at the given object

……or naming context.

Note : The search  returns null, if the id does not exist in the specified location.




Related Posts :
Solution to SSLHandshakeException (skip the certificate for Java and LDAP bind)
SELECT statement to get records from the table in sql
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
Add new entry in OpenLdap using java JNDI
Connect to the OpenLdap with java JNDI
   [will not be published]



^ <