Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DBMS_LDAP Package - extract name and user id from AD Groups

931534Jan 13 2017 — edited Jan 16 2017

Hi Community, Good Afternoon!. We have a requirement to extract active directory (AD) group name and user id on demand. So we installed DBMS_LDAP package on the db.

We tested the connection with below and worked well :

SET SERVEROUTPUT ON;

DECLARE

  l_retval       NUMBER;

  l_session      DBMS_LDAP.session;

  l_ldap_base    VARCHAR2(256) := 'dc=xxxxxxx,dc=xxx';

BEGIN

  -- Choose to raise exceptions.

  DBMS_LDAP.USE_EXCEPTION := TRUE;

    -- Connect to the LDAP server.

l_session := DBMS_LDAP.init(hostname => 'xxxxxx',

                                               portnum  => 'xxxxx');

l_retval := DBMS_LDAP.simple_bind_s(ld     => l_session,

                                                             dn     => xxxx,

                                                             passwd => xxxx);

DBMS_OUTPUT.PUT_LINE(l_retval);

-- Disconnect from the LDAP server.

l_retval := DBMS_LDAP.unbind_s(ld => l_session);

DBMS_OUTPUT.PUT_LINE('done');

DBMS_OUTPUT.PUT_LINE(l_retval);

END;

/

I am trying to create a function that will return the name and userid details with groupname as in put.

But I am not sure where to start on this? Also, I found below highlighted on the oracle docs

Dependencies and Limitations

The PL/SQL LDAP API for this release has the following limitations:

  • The LDAP session handles obtained from the API are valid only for the duration of the database session. The LDAP session handles cannot be written to a table and re-used in other database sessions.
  • Only synchronous versions of LDAP API functions are supported in this release.
  • The PL/SQL LDAP API requires a database connection to work. It cannot be used in client-side PL/SQL engines (like Oracle Forms) without a valid database connection.

Is it possible to create a function with DBMS_LDAP to extract the user name and user id details ? If Yes, please provide the sample documentation so I will work on my function.

No, how we can do in PL/SQL ?

Thanks in advance...

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 13 2017
Added on Jan 13 2017
2 comments
1,168 views