This package enables a pl/sql developer to have a friendly interface to ldap. It is completely based on dbms_ldap, but exposes a simple and easy to use interface based on structured data representation of an ldap entry.
Friendly pl/sql ldap api
User feedback will drive development, submit your requests:
http://sourceforge.net/tracker/?group_id=234975
Source via CVS (initial release):
http://plsqlldap.cvs.sourceforge.net/viewvc/*checkout*/plsqlldap/plsqlldap/src/plsqlldap.sql
Create a database user to contain the sample application
Download the sql file: http://plsqlldap.cvs.sourceforge.net/viewvc/*checkout*/plsqlldap/plsqlldap/src/plsqlldap.sql
sqlplus user/pwd @plsqlldap.sql
Test it
declare
v_ldap plsqlldap.ldap;
v_user_dn varchar2(1024);
v_ldap_entry_arr plsqlldap.entry_arr;
v_user_rowid rowid;
begin
v_ldap.host := 'localhost';
v_ldap.port := 389;
v_ldap.user := 'uid=admin,ou=system';
v_ldap.passwd := 'secret';
plsqlldap.init_ldap(v_ldap);
dbms_output.put_line('init done');
plsqlldap.connect_to_ldap;
dbms_output.put_line('connected');
v_ldap_entry_arr := plsqlldap.ldapsearch(p_base => 'dc=example,dc=com',
p_scope => 'one',
p_filter => '(objectclass=*)',
p_attrs => plsqlldap.vc_list('*'));
for i in 1..v_ldap_entry_arr.count loop
dbms_output.put_line ('dn: '||v_ldap_entry_arr(i).dn);
for j in 1..v_ldap_entry_arr(i).attrs.count loop
for y in 1..v_ldap_entry_arr(i).attrs(j).vals.count loop
dbms_output.put_line (v_ldap_entry_arr(i).attrs(j).name||': '||v_ldap_entry_arr(i).attrs(j).vals(y));
end loop;
end loop;
dbms_output.put_line ('');
end loop;
plsqlldap.disconnect_from_ldap;
exception
when others then
begin
plsqlldap.disconnect_from_ldap;
exception
when others then
null;
end;
dbms_output.put_line('err: '||sqlerrm(sqlcode));
end;
enjoy
If you get any other problem please submit a support request:
http://sourceforge.net/tracker/?group_id=234975
plsqlldap is developed by Andrea A.A. Gariboldi