Hi,
I wrote a ldap authentication function to check the user exist in the active directory or not. Please find the code below I am getting the following error when i run the plsql block
I am using oracle 11g express edition and front end as oracle application express 4.1
DECLARE
P_USERNAME VARCHAR2(500) := 'sudhirn';
P_PASSWORD VARCHAR2(500) := 'sudhir123';
L_USER VARCHAR2(256);
L_LDAP_SERVER VARCHAR2(256) := 'sudhir.com';
L_DOMAIN VARCHAR2(256) := 'sudhir.com';
L_LDAP_PORT NUMBER := 389;
L_RETVAL PLS_INTEGER;
L_SESSION DBMS_LDAP.SESSION;
l_cnt number;
BEGIN
l_user := p_username||'@'||l_domain;
l_session := dbms_ldap.init( l_ldap_server, l_ldap_port ); -- start session
l_retval := dbms_ldap.simple_bind_s( l_session, l_user, p_password ); -- auth as user
L_RETVAL := DBMS_LDAP.UNBIND_S( L_SESSION ); -- unbind
dbms_output.put_line('yes');
exception when others then
l_retval := dbms_ldap.unbind_s( l_session );
dbms_output.put_line('no');
END;
/
When i run the above code i get the following error
ORA-31204: DBMS_LDAP: PL/SQL - Invalid LDAP Session.
Please suggest me how to fix this.
Thanks
Sudhir