javaactive-directoryjndi

LdapContext vs dircontext in JNDI


Please explain the difference between using ldapcontext and dircontext in JNDI.

I found that there are JNDI samples using both ldapcontext and dircontext. Which should I use?


Solution

  • From JavaDocs about ldapcontext

    This interface represents a context in which you can perform operations with LDAPv3-style controls and perform LDAPv3-style extended operations. For applications that do not require such controls or extended operations, the more generic javax.naming.directory.DirContext should be used instead.