• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

JNDI ? is it necessary

Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all
I am developing an application related to chat that has to use LDAP as the directory service. I have started refering JNDI tutorial of SUN. I wanted to ask that it is necessary to read JNDI to proceed for LDAP.
What would be best help i could get to understand LDAP.
One more thing how to create directory using LDAP
All needs to be in JAVA
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use Sun API you�ll need a high level understanding of the JNDI concepts, since in a nutshell LDAP is a more specialized form of JNDI. So it uses the underlying JNDI service for resolving LDAP requests. However if you chose the Netscape Directory SDK (which was bought by Sun anyway) you might skip understanding (at least for now) the JNDI concepts. If you need more advanced knowledge you can try to integrate the Netscape Directory SDK with JNDI. You might like checking this link:


Below there is some code extras that help you understand how to connect to the LDAP database and create a new entry (remark that no JNDI knowledge is required).
LDAPConnection ldapConn = new LDAPConnection();

ldapConn.connect(3, "localhost", "1080",
"uid=$system$,ou=internalPeople,dc=acme,dc=com", "weblogic");
ldapConn.setOption(LDAPv2.SIZELIMIT, new Integer(0));
ldapConn.setOption(LDAPv2.REFERRALS, Boolean.TRUE);
ldapConn.setOption(LDAPv2.BATCHSIZE, new Integer(1000));
ldapConn.setOption(LDAPv2.TIMELIMIT, new Integer(15000));


String[] objectclasses = {"top", "groupofuniquenames"};
LDAPAttribute objectClass = new LDAPAttribute("objectclass",
LDAPAttribute cn = new LDAPAttribute("cn", "cn=WebAdmin,ou=roles,dc=acme,dc=com");

LDAPAttributeSet attrSet = new LDAPAttributeSet();


LDAPAttribute description = new LDAPAttribute("description",
"Role for web administrators");

String roleDn = LdapUtil.distinguishedRoleName(role.getRoleName());
LDAPEntry entry = new LDAPEntry(roleDn, attrSet);

The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic