java2db

Search or select entry from OpenLdap with java JNDI



Every entry contains an unique identity.So search or select entry from OpenLdap using entry Id.

Requirements to Search or select entry from OpenLdap  :

Software requirement:

……Connect to the OpenLdap OpenLDAP (Download  OpenLDAP).

……Connect to the OpenLdap Java  (Download  Java).

Connect to the OpenLdapAuthentication requirement :

……Connect to the OpenLdap OpenLDAP  IP and PORT.

……Connect to the OpenLdap Login DN , Password.

Entry is a set of attributes.Each attribute exists with id and it’s value .There are five entries in the above example diagram.

Example to search or select entry from OpenLdap :

Execution Result:

Search or select entry from OpenLdap Line number 17 to 29 ,bind to OpenLdap with valid credentials.
Search or select entry from OpenLdapSearchControls class is useful to search the entries in  the OpenLdap active directory system.

 …..This class contains three static constants like,
…… SearchControls.OBJECT_SCOPE : To search the named object.
…… SearchControls.ONELEVEL_SCOPE : To search one level of the named context.
…… SearchControls.SUBTREE_SCOPE : To search the entire sub tree rooted at the named object.
Search or select entry from OpenLdapldapContext.search(“uid=1231, ou=People,dc=maxcrc,dc=com“,”(uid=1231)“, searcCon) method

……will take three arguments.
…… uid=1231,ou=People,dc=maxcrc,dc=com  : Full DN.
…… (uid=1231)  : is the search filter.
…… searcCon    : static search constant .
Search or select entry from OpenLdapThe search will return a NamingEnumeration.
Search or select entry from OpenLdapIterate NamingEnumeration object , to get value by attribute id(line 48 to 55).




Related Posts :
How to Connect to Oracle from Liferay portlet ( Java Liferay and Oracle integration )
How to Connect Liferay 7 to PostgreSQL ( Java Liferay portlet and PostgreSQL integration )
How to call C# .Net WCF web service in java SOAP client ( Visual Studio 2013 )
How to call PHP RESTful web service in java client
How to call java SOAP web service in php ( php web service client )
Solution to SSLHandshakeException (skip the certificate for Java and LDAP bind)
Java RESTful web service example in maven using JAX-RS
RESTful web service example in java using JAX-RS
   [will not be published]



^ <