Validating email server username and password in oracle (zimbra server)

  l_ldap_host    VARCHAR2(256) := ‘’;
  l_ldap_port    VARCHAR2(256) := ‘389’;
  l_ldap_user    VARCHAR2(256) := ‘uid=user,ou=people,dc=domainname,dc=com’;
  l_ldap_passwd  VARCHAR2(256) := ‘password‘;
  l_retval       PLS_INTEGER;
  l_session      DBMS_LDAP.session;
  l_attrs        DBMS_LDAP.string_collection;
  l_message      DBMS_LDAP.message;
  l_entry        DBMS_LDAP.message;
  l_attr_name    VARCHAR2(256);
  l_ber_element  DBMS_LDAP.ber_element;
  l_vals         DBMS_LDAP.string_collection;
  — Choose to raise exceptions.
  — 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);
  DBMS_OUTPUT.PUT_LINE(‘bind:L_RETVAL: ‘ || l_retval);
  l_retval := DBMS_LDAP.unbind_s(ld => l_session);
  DBMS_OUTPUT.PUT_LINE(‘unbind:L_RETVAL: ‘ || l_retval);

— replace user with email id without domain name, password with email password

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s