title: Get LDAP user list using PLSQL
body: <p>One of the new requirements for our database application is to synchronize the contents of the user table with the users in Active Directory. So basically I need to connect to the Active Directory server and retrieve a list of user names, from within a plsql procedure. </p>
  
  <p>What I have achieved so far is connect to the active directory server, using my own credentials, and query some attributes. </p>
  
  <p>Example:</p>
  
  <pre><code>ldap_password := '****';
  ldap_user     := 'cn=me,OU=Users,OU=mygroup,DC=mytown,DC=mycompany,DC=com';
  ldap_base     := 'OU=Users,OU=mygroup,DC=mytown,DC=mycompany,DC=com';
  search_filter := '(&amp;(objectClass=Person)!((sn=him)(cn=me)))';
  res_attrs(1)  := 'displayName';
  res_attrs(2)  := 'cn';
  res_attrs(3)  := 'telephoneNumber';
  </code></pre>
  
  <p>It seems I can only query my own attributes or somebody else's if I already know who that someone else is. </p>
  
  <ul>
  <li>How do I get a list of usernames?</li>
  <li>Is this possible using any account or does this require an account with the proper privileges?</li>
  </ul>