Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to change user password in OID
I'm sorry.
The right code is
DBMS_LDAP.populate_mod_array(my_array, DBMS_LDAP.MOD_ADD, 'userPassword',
my_vals);
"Vasily Poushko" <vasily_at_rbcmail.ru> wrote in message
news:amqblb$b0h$1_at_n6.co.ru...
> I try to change user password by this script, but get the error:
ORA-31202:
> DBMS_LDAP: LDAP client/server error: Type or value exists
>
> How can I fix it?
>
> DECLARE
> retval PLS_INTEGER;
> my_session DBMS_LDAP.session;
> my_attrs DBMS_LDAP.string_collection;
> my_message DBMS_LDAP.message;
> my_entry DBMS_LDAP.message;
>
> my_array DBMS_LDAP.MOD_ARRAY;
> 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;
> -- Please customize the following variables as needed
> ldap_host := <host>;
> ldap_port := '4032';
> ldap_user := 'cn=orcladmin';
> ldap_passwd:= <pass>;
> ldap_base := ' ';
> -- end of customizable settings
> DBMS_OUTPUT.PUT('DBMS_LDAP Change Password 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);
> -- Choosing exceptions to be raised by DBMS_LDAP library.
> DBMS_LDAP.USE_EXCEPTION := TRUE;
> 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)');
> -- bind to the directory
> retval := DBMS_LDAP.simple_bind_s(my_session, ldap_user, ldap_passwd);
>
> my_array := DBMS_LDAP.create_mod_array(1);
> my_vals(1) := 'user12348';
>
> DBMS_LDAP.populate_mod_array(my_array, DBMS_LDAP.MOD_ADD, 'sn', my_vals);
> retval := DBMS_LDAP.modify_s(my_session,
> 'cn=user99999,cn=users,dc=genesyslab,dc=com', my_array);
> DBMS_LDAP.free_mod_array(my_array);
>
> retval := DBMS_LDAP.unbind_s(my_session);
>
> DBMS_OUTPUT.PUT_LINE(RPAD('unbind_res Returns ',25,' ') || ': ' ||
> TO_CHAR(retval));
> DBMS_OUTPUT.PUT_LINE('Directory operation Successful .. exiting');
> -- Handle Exceptions
> EXCEPTION
> WHEN OTHERS THEN
> DBMS_OUTPUT.PUT_LINE(' Error code : ' || TO_CHAR(SQLCODE));
> DBMS_OUTPUT.PUT_LINE(' Error Message : ' || SQLERRM);
> DBMS_OUTPUT.PUT_LINE(' Exception encountered .. exiting');
> END;
> /
>
>
>
>
Received on Tue Sep 24 2002 - 13:50:14 CDT