BEGIN
--Create the ACL
dbms_network_acl_admin.create_acl(
acl => 'ldap',
description => 'ldap host',
principal => 'SYSTEM',
is_grant => TRUE,
privilege => 'connect'
);
END;
/
BEGIN
--Assign hosts and ports to the ACl
dbms_network_acl_admin.assign_acl(
acl => 'ldap',
host => '10.10.1.9',
lower_port => 389
);
-- add user to the acl
dbms_network_acl_admin.add_privilege(
acl => 'ldap',
principal => 'PUBLIC',
is_grant => TRUE,
privilege => 'connect'
);
END;
/
DECLARE
l_ldap_host VARCHAR2(256) := '10.10.1.9'; --Supplying the values
l_ldap_port VARCHAR2(256) := '389';
l_ldap_user VARCHAR2(256) := '[email protected]'; --
Supplying the values
l_ldap_password VARCHAR2(256) := 'MDP';
l_retval PLS_INTEGER;
l_session DBMS_LDAP.session;
BEGIN
-- Connect to the LDAP server.
l_session := DBMS_LDAP.init(hostname => l_ldap_host,
portnum => l_ldap_port);
l_retval := DBMS_LDAP.simple_bind_s(ld => l_session,
dn => l_ldap_user,
passwd => l_ldap_password);
dbms_output.put_line(l_retval);
l_retval := DBMS_LDAP.unbind_s(ld => l_session);
END;