Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> PL/SQL accessing LDAP server

PL/SQL accessing LDAP server

From: M Rothwell <ThisIsABadAddress_at_toobad.com>
Date: Wed, 16 Feb 2005 16:06:15 -0800
Message-ID: <4213e034$1@usenet01.boi.hp.com>


I am trying to get information from an LDAP server using the DBMS_LDAP package. I got the following code from the sample directory that came with the Oracle dist.

I have the correct LDAP server and port. I can init and bind, but when I get to the search_st procedure it errors out with the following message:

Error Message : ORA-31202: DBMS_LDAP: LDAP client/server error: No such object

I'm using Oracle 9i R2 on HP-UX.

I have tried different filters and scopes, but still get the same error.   Any help would be much appreciated.

DECLARE
  retval PLS_INTEGER;

  my_session   DBMS_LDAP.session;
  my_attrs     DBMS_LDAP.string_collection;
  my_timeout   DBMS_LDAP.timeval;
  my_message   DBMS_LDAP.message;
  my_entry     DBMS_LDAP.message;
  entry_index  PLS_INTEGER;
  my_dn        VARCHAR2(256);

  my_attr_name VARCHAR2(256);
  my_ber_elmt DBMS_LDAP.ber_element;
  attr_index PLS_INTEGER;
  i PLS_INTEGER;
  my_vals DBMS_LDAP.STRING_COLLECTION ;
  ldap_host    VARCHAR2(256);
  ldap_port    VARCHAR2(256);
  ldap_user    VARCHAR2(256);
  ldap_passwd  VARCHAR2(256);
  ldap_base    VARCHAR2(256);
BEGIN
  retval         := -1;

  DBMS_OUTPUT.PUT('DBMS_LDAP Search Example ');
  DBMS_OUTPUT.PUT_LINE('to directory .. ');
  DBMS_OUTPUT.PUT_LINE(RPAD('LDAP Host ',25,' ') || ': ' || ldap_host);
  DBMS_OUTPUT.PUT_LINE(RPAD('LDAP Port ',25,' ') || ': ' || ldap_port);

  my_session := DBMS_LDAP.init(ldap_host,ldap_port);

  DBMS_OUTPUT.PUT_LINE (RPAD('Ldap session ',25,' ') || ': ' ||

      RAWTOHEX(SUBSTR(my_session,1,8)) ||
      '(returned from init)');

  DBMS_OUTPUT.PUT_LINE(RPAD('simple_bind_s Returns ',25,' ') || ': '

           || TO_CHAR(retval));

  DBMS_OUTPUT.PUT_LINE(RPAD('search_s Returns ',25,' ') || ': '

           || TO_CHAR(retval));
  DBMS_OUTPUT.PUT_LINE (RPAD('LDAP message ',25,' ') || ': ' ||

      RAWTOHEX(SUBSTR(my_message,1,8)) ||
      '(returned from search_s)');

DBMS_OUTPUT.PUT_LINE('---------------------------------------------------');


DBMS_OUTPUT.PUT_LINE('===================================================');

    entry_index := entry_index+1;
  end loop;

  DBMS_OUTPUT.PUT_LINE('Directory operation Successful .. exiting');

Received on Wed Feb 16 2005 - 18:06:15 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US