Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi I've done some research on this matter but can't find a real answer for this: The company needs to sync a user table with the active directory. We are using LDAP from a Oracle database to connect to the AD. Ok at first didn't sound hard BUT then researching how the Ad was organized it got complicated. The structure is at follows:

SQL
Active Directory Users and Computers
   +Saved Queries
   -Company.org
      -OrganizationalUnit(root this is where we start)
          -OU folder Regions
             +OU folder Computers
             -OU folder Users
                +Users we need
      +Other Stuff

The problem is the subtree its divided on Organizational units nested on organizational units. I've tried different approaches and as far as I have got is to list the OU Users Names, NOT the users instead, and list the OU of regions too. Just need a point in the right directions.
Posted
Updated 30-Aug-12 2:38am
v2

1 solution

Ok i solved my issue,
Active Directory Users and Computers  
   +Saved Queries
   -Company.org
      -OrganizationalUnit <-----Starting Position
          -OU folder Regions
             +OU folder Computers
             -OU folder Users
                +Users we need
      +Other Stuff


Aparently using the DBMS_LDAP.SCOPE_SUBTREE it let me browse through all my starting position and all in between. Just had to tweak the filter to provide the users, its final form was:
(&(&(objectCategory=user)(objectClass=user)(memberOf=*)(samaccountname='||LDAP_USER||')))

Finally i got PL/SQL procedure that searches the Active Directory and updates the users table with a valid AD email :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900