Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8552167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:21:48+00:00 2026-06-11T14:21:48+00:00

Well this my java code that allows me to connect to the ldap server.

  • 0

Well this my java code that allows me to connect to the ldap server.

  public static Hashtable getConnexion()
           {

       env.put(Context.INITIAL_CONTEXT_FACTORY,
            "com.sun.jndi.ldap.LdapCtxFactory");
       env.put(Context.PROVIDER_URL, "ldap://localhost:10389");
       env.put(Context.SECURITY_AUTHENTICATION, "simple");
       env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system"); 
       env.put(Context.SECURITY_CREDENTIALS, "secret");
       return env;

       }

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:21:49+00:00Added an answer on June 11, 2026 at 2:21 pm

    If the LDAP client is standalone, it could be configured in several ways:

    Use the UnboundID LDAP SDK LDAPCommandLineTool class and specify arguments to the program. For example, if the name of the class containing the main method was samplecode.MyLdapConnectionClass:

    java -cp my-classpath samplecode.MyLdapConnectionClass --hostname localhost \
           --port 10389 \
           --bindDN "uid=admin,ou=system" \
           --bindPassword "secret"
    

    The UnboundID LDAP SDK LDAPCommandLineTool class handles all these types of command line arguments automatically, for example:

    • --hostname (or -h) for the hostname
    • --port (or -p) for the port
    • all SASL and Simple BIND arguments
    • all secure connection arguments, for example (--useSSL or --useStartTLS)

    The LDAPCommandLineTool class inherits a method getConnection() which establishes a connection to the server specified by those command line arguments.

    or specify the name of a properties file and parse the properties file using Apache Commons Configuration or the load() method of java.util.properties.

    Either way, JNDI should not be used for new code. Use the UnboundID LDAP SDK instead.

    see also

    • LDAP: Sample Code
    • LDAP: Programming Practices
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Java I have code that works well on OSX but not in linux.
It is well known that Java Language allows compliers to re-arrange lines of compiled
I believe this question applies equally well to C# as to Java, because both
Well this file was put in the repo by mistake and was deleted and
I don't understand very well this code: var img = $('<img/>', {class: photo, src:
I hope I can explain this well enough so that you can understand the
The following simple code in Java behaves somewhat in a strange way that I
Well how to evaluate a very simple antlr grammar that does only this. Box(1,2,4)
I have some Java code that needs to compile with current generics aware compilers
I'm current working on a Java code that is using JaxB to handle reading/writing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.