title: Java eclipse - Active directory, attribute modification #2
body: <p>Thanks first to  Sotirios Delimanolis who help me for my first question (first part was to access to the active directory).</p>
  
  <p>So now my code is :</p>
  
  <pre><code>        DirContext ctx = null;
  
          Hashtable&lt;String, Object&gt; env = new Hashtable&lt;String, Object&gt;();
          env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
          env.put(Context.PROVIDER_URL, "ldap://"+serverAddress+":389");
  
          env.put(Context.SECURITY_AUTHENTICATION, "simple");
          env.put(Context.SECURITY_PRINCIPAL, DOMAIN+username);
          env.put(Context.SECURITY_CREDENTIALS, password);
  
          try {
  
  
              // Create the initial context
              ctx = new InitialDirContext(env);
  
              Attributes matchAttrs = new BasicAttributes(true); // ignore attribute name case
              matchAttrs.put(new BasicAttribute("mail", "XXXXXX@XXXX.com"));
              matchAttrs.put(new BasicAttribute("cn"));
  
              // Search for objects that have those matching attributes
              NamingEnumeration&lt;SearchResult&gt; answer = ctx.search("ou=People", matchAttrs);
  
              while (answer.hasMore()) {
                  SearchResult sr = (SearchResult)answer.next();
                  System.out.println("&gt;&gt;&gt;" + sr.getName());
              }
  </code></pre>
  
  <p>I have the error : 
  <code>Failed to bind to LDAP / get account information: javax.naming.NamingException: [LDAP: error code 1 - 000020D6: SvcErr: DSID-03100754, problem 5012 (DIR_ERROR), data 0 ; remaining name 'ou=People'</code></p>
  
  <p>I found this code (that follow) in <a href="http://docs.oracle.com/javase/jndi/tutorial/basics/directory/basicsearch.html" rel="nofollow">http://docs.oracle.com/javase/jndi/tutorial/basics/directory/basicsearch.html</a> :</p>
  
  <pre><code>// Specify the attributes to match
  // Ask for objects that has a surname ("sn") attribute with 
  // the value "Geisel" and the "mail" attribute
  Attributes matchAttrs = new BasicAttributes(true); // ignore attribute name case
  matchAttrs.put(new BasicAttribute("sn", "Geisel"));
  matchAttrs.put(new BasicAttribute("mail"));
  
  // Search for objects that have those matching attributes
  NamingEnumeration answer = ctx.search("ou=People", matchAttrs);
   You can then print the results as follows. 
  while (answer.hasMore()) {
      SearchResult sr = (SearchResult)answer.next();
      System.out.println("&gt;&gt;&gt;" + sr.getName());
      printAttrs(sr.getAttributes());
  }
  </code></pre>
  
  <p>So I want to know if he target context "ou=People" is specific to each active directory or its always the same for the "ou" and the "People" : <a href="http://www.kouti.com/tables/userattributes.htm" rel="nofollow">http://www.kouti.com/tables/userattributes.htm</a></p>
  
  <p>Thanks a lot !</p>