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!

How to fix ORA-31204: DBMS_LDAP: PL/SQL - Invalid LDAP Session.

Sudhir_MeruSep 20 2012
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 18 2012
Added on Sep 20 2012
0 comments
2,575 views