Slow LDAP Connection
909167Jan 27 2012 — edited Jan 30 2012Hi,
I am using the below funtion to connect with the LDAP. But the connection speed is very very slow. Taking more than 10 min to generate the ouput.
Here is the function.
create or replace FUNCTION F_TEST_LDAP (loginname VARCHAR2)
RETURN NUMBER
IS
-- Adjust as necessary.
l_ldap_host VARCHAR2(256) := '';
l_ldap_port VARCHAR2(256) := '';
l_ldap_user VARCHAR2(256) := '';
l_ldap_passwd VARCHAR2(256) := '';
l_ldap_base VARCHAR2(256) := '';
l_retval PLS_INTEGER;
l_session DBMS_LDAP.session;
l_attrs DBMS_LDAP.string_collection;
l_message DBMS_LDAP.message;
l_filter varchar2(30):='sAMAccountName='||loginname;
l_count NUMBER:=0;
BEGIN
-- Choose to raise exceptions.
DBMS_LDAP.USE_EXCEPTION := TRUE;
-- 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_passwd);
-- Get all attributes
l_attrs(1) := '*'; --'*'; -- retrieve all attributes
l_retval := DBMS_LDAP.search_s(ld => l_session,base => l_ldap_base,scope => DBMS_LDAP.SCOPE_SUBTREE,filter => l_filter,attrs => l_attrs,attronly => 0,res => l_message);
l_count:=DBMS_LDAP.count_entries(ld => l_session, msg => l_message);
-- Disconnect from the LDAP server.
l_retval := DBMS_LDAP.unbind_s(ld => l_session);
return l_count;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error :'||SQLERRM);
return 0;
END F_TEST_LDAP;
Could someone please help me to fine tune the connection speed?