Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 548
  • Last Modified:

Context interface in java

hi all, please explain me what is the use of Context() in java. I read javadoc but didn't understand. Please also explain use of INITIAL_CONTEXT_FACTORY  and PROVIDER_URL.
1 Solution
Kevin CrossChief Technology OfficerCommented:
The "D" is the important part of JNDI when trying to figure out the significance of Context.  The Context in a directory service is the level at which you are in the tree.  For example ou=users,o=somedirectory or ou=users,dc=someds,dc=somedomain,dc=com are contexts within a given directory.

The INITAL_CONTEXT_FACTORY establishes the API (vendor) of the LDAP directory.  com.sun.jndi.ldap.LdapCtxFactory for example.

PROVIDER_URL is a string formatted according to the context factory above that specifies the LDAP server to contact and the initial directory location to open.  This may be of importance if the proxy account (user name and password used to bind to LDAP) only has visibility at a certain level in the tree.  Otherwise, you may see the PROVIDER_URL as the server name, port, root of directory.


jayz_smithAuthor Commented:
good try.

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now