Oracle9i Supplied PL/SQL Packages and Types Reference Release 2 (9.2) Part Number A96612-01 |
|
DBMS_LDAP , 2 of 2
This function initializes a session with an LDAP server. This actually establishes a connection with the LDAP server.
DBMS_LDAP.init ( hostname IN VARCHAR2, portnum IN PLS_INTEGER ) RETURN SESSION;
Value | Description |
---|---|
|
A handle to an LDAP session that can be used for further calls into the API. |
DBMS_LDAP.init
is the first function that should be called in order to establish a session to the LDAP server. DBMS_LDAP.
init returns a session handle, a pointer to an opaque structure that must be passed to subsequent calls pertaining to the session. This routine returns NULL
and raises the INIT_FAILED
exception if the session cannot be initialized. Subsequent to the call to init,
the connection must be authenticated using DBMS_LDAP.bind_s
or DBMS_LDAP.simple_bind_s.
See Also:
|
This function can be used to perform simple username/password based authentication to the directory server.
DBMS_LDAP.simple_bind_s ( ld IN SESSION, dn IN VARCHAR2, passwd IN VARCHAR2) RETURN PLS_INTEGER;
Parameter | Description |
---|---|
|
A valid LDAP session handle. |
|
The distinguished name of the user under which you are trying to login. |
|
A text string containing the password. |
Value | Description |
---|---|
|
|
DBMS_LDAP.simple_bind_s
can be used to authenticate a user whose directory distinguished name and directory password are known. It can be called only after a valid LDAP session handle is obtained from a call to DBMS_LDAP.init.
This function performs complex authentication to the directory server.
DBMS_LDAP.bind_s ( ld IN SESSION, dn IN VARCHAR2, cred IN VARCHAR2, meth IN PLS_INTEGER ) RETURN PLS_INTEGER;
Value | Description |
---|---|
|
|
DBMS_LDAP.bind_s
can be used to authenticate a user. It can be called only after a valid LDAP session handle is obtained from a call to DBMS_LDAP.init.
See Also:
|
This function closes an active LDAP session.
DBMS_LDAP.unbind_s ( ld IN SESSION ) RETURN PLS_INTEGER;
Parameter | Description |
---|---|
|
A valid LDAP session handle. |
Value | Description |
---|---|
|
SUCCESS on proper completion. One of the exceptions listed in Table 21-15 is raised otherwise. |
Exception | Description |
---|---|
invalid_session |
Raised if the session handle ld is invalid. |
general error |
For all other errors. The error string associated with this exception explains the error in detail. |
The unbind_s
function sends an unbind request to the server, closes all open connections associated with the LDAP session, and disposes of all resources associated with the session handle before returning. After a call to this function, the session handle ld is invalid and it is illegal to make any further LDAP API calls using ld.
See Also:
|
This function tests whether a particular attribute in a particular entry has a particular value.
DBMS_LDAP.compare_s ( ld IN SESSION, dn IN VARCHAR2, attr IN VARCHAR2, value IN VARCHAR2) RETURN PLS_INTEGER;
Value | Description |
---|---|
|
|
Exception | Description |
---|---|
|
Raised if the session handle ld is invalid. |
|
For all other errors. The error string associated with this exception explains the error in detail. |
The function compare_s
can be used to assert if the value of a given attribute stored in the directory server matches a certain value.This operation can only be performed on attributes whose syntax definition allows them to be compared. The compare_s
function can only be called after a valid LDAP session handle has been obtained from the init
function and authenticated using the bind_s
or simple_bind_s
functions.
This function performs a synchronous search in the LDAP server. It returns control to the PL/SQL environment only after all of the search results have been sent by the server or if the search request is timed out by the server.
FUNCTION search_s ( ld IN SESSION, base IN VARCHAR2, scope IN PLS_INTEGER, filter IN VARCHAR2, attrs IN STRING_COLLECTION, attronly IN PLS_INTEGER, res OUT MESSAGE) RETURN PLS_INTEGER;
This function issues a search operation, and does not return control to the user environment until all of the results have been returned from the server. Entries returned from the search, if any, are contained in the res
parameter. This parameter is opaque to the caller. Entries, attributes, values, and so on can be extracted by calling the parsing routines described in the following sections.
This function performs a synchronous search in the LDAP server with a client-side timeout. It returns control to the PL/SQL environment only after all of the search results have been sent by the server or if the search request is timed out by the client or the server.
DBMS_LDAP.search_st ( ld IN SESSION, base IN VARCHAR2, scope IN PLS_INTEGER, filter IN VARCHAR2, attrs IN STRING_COLLECTION, attronly IN PLS_INTEGER, tv IN TIMEVAL, res OUT MESSAGE) RETURN PLS_INTEGER;
This function is very similar to DBMS_LDAP.search_s,
except that it requires a timeout value.
This function retrieves the first entry in the result set returned by either search_s
or search_st
DBMS_LDAP.first_entry ( ld IN SESSION, msg IN MESSAGE ) RETURN MESSAGE;
Parameter | Description |
---|---|
|
A valid LDAP session handle. |
|
The search result obtained by a call to one of the synchronous search routines. |
Value | Description |
---|---|
MESSAGE |
A handle to the first entry in the list of entries returned from the LDAP server. It is set to |
Exception | Description |
---|---|
|
Raised if the session handle ld is invalid. |
|
Raised if the incoming msg handle is invalid. |
The function first_entry
should always be the first function used to retrieve the results from a search operation.
This function iterates to the next entry in the result set of a search operation.
DBMS_LDAP.next_entry ( ld IN SESSION, msg IN MESSAGE ) RETURN MESSAGE;
Parameter | Description |
---|---|
|
A valid LDAP session handle. |
|
The search result, as obtained by a call to one of the synchronous search routines. |
Value | Description |
---|---|
MESSAGE |
A handle to the next entry in the list of entries returned from the LDAP server. It is set to |
Exception | Description |
---|---|
|
Raised if the session handle, ld is invalid. |
|
Raised if the incoming msg handle is invalid. |
The function next_entry
should always be called after a call to first_entry.
Also, the return value of a successful call to next_entry
should be used as msg
argument used in a subsequent call to next_entry
to fetch the next entry in the list.
This function counts the number of entries in the result set. It can also count the number of entries remaining during a traversal of the result set using a combination of the functions first_entry
and next_entry.
DBMS_LDAP.count_entries ( ld IN SESSION, msg IN MESSAGE ) RETURN PLS_INTEGER;
Parameter | Description |
---|---|
|
A valid LDAP session handle |
|
The search result, as obtained by a call to one of the synchronous search routines |
Value | Description |
---|---|
PLS INTEGER |
Nonzero if there are entries in the result set -1 if there was a problem. |
The count_entries
function returns the number of entries contained in a chain of entries. If an error occurs, such as the res
parameter being invalid, -1
is returned. The count_entries
call can also be used to count the number of entries that remain in a chain if called with a message, entry, or reference returned by first_message, next_message, first_entry, next_entry, first_reference,
and next_reference.
This function fetches the first attribute of a given entry in the result set.
DBMS_LDAP.first_attribute ( ld IN SESSION, msg IN MESSAGE, ber_elem OUT BER_ELEMENT) RETURN VARCHAR2;
Exception | Description |
---|---|
|
Raised if the session handle ld is invalid. |
|
Raised if the incoming msg handle is invalid. |
The handle to the BER_ELEMENT
returned as a function parameter to first_attribute
should be used in the next call to next_attribute
to iterate through the various attributes of an entry. The name of the attribute returned from a call to first_attribute
can in turn be used in calls to the functions get_values
or get_values_len
to get the values of that particular attribute.
This function fetches the next attribute of a given entry in the result set.
DBMS_LDAP.next_attribute ( ld IN SESSION, msg IN MESSAGE, ber_elem IN BER_ELEMENT) RETURN VARCHAR2;
Value | Description |
---|---|
|
The name of the attribute, if it exists. |
Exception | Description |
---|---|
|
Raised if the session handle ld is invalid. |
|
Raised if the incoming msg handle is invalid. |
The handle to the BER_ELEMENT
returned as a function parameter to first_attribute
should be used in the next call to next_attribute
to iterate through the various attributes of an entry. The name of the attribute returned from a call to next_attribute
can in turn be used in calls to get_values
or get_values_len
to get the values of that particular attribute.
This function retrieves the X.500 distinguished name of a given entry in the result set.
The function first_attribute
fetches the first attribute of a given entry in the result set
DBMS_LDAP.get_dn ( ld IN SESSION, msg IN MESSAGE) RETURN VARCHAR2;
Parameter | Description |
---|---|
|
A valid LDAP session handle. |
|
The entry whose DN is to be returned. |
Value | Description |
---|---|
|
The X.500 distinguished name of the entry as a PL/SQL string.
|
The function get_dn
can be used to retrieve the DN of an entry as the program logic is iterating through the result set. This be used as an input to explode_dn
to retrieve the individual components of the DN.
This function retrieves all of the values associated for a given attribute in a given entry.
DBMS_LDAP.get_values ( ld IN SESSION, ldapentry IN MESSAGE, attr IN VARCHAR2) RETURN STRING_COLLECTION;
Value | Description |
---|---|
|
A PL/SQL string collection containing all of the values of the given attribute.
|
Exception | Description |
---|---|
|
Raised if the session handle ld is invalid. |
|
Raised if the incoming entry handle is invalid. |
The function get_values
can only be called after the handle to entry has been first retrieved by a call to either first_entry
or next_entry.
The name of the attribute can be known beforehand, and it can also be determined by a call to first_attribute
or next_attribute.
The function get_values
always assumes that the datatype of the attribute it is retrieving is String. For retrieving binary datatypes, use get_values_len.
This function retrieves values of attributes that have a Binary syntax.
DBMS_LDAP.get_values_len ( ld IN SESSION, ldapentry IN MESSAGE, attr IN VARCHAR2) RETURN BINVAL_COLLECTION;
Value | Description |
---|---|
|
A PL/SQL Raw collection containing all the values of the given attribute.
|
Exception | Description |
---|---|
|
Raised if the session handle ld is invalid. |
|
Raised if the incoming entry handle is invalid |
The function get_values_len
can only be called after the handle to entry has been retrieved by a call to either first_entry
or next_entry.
The name of the attribute can be known beforehand, and it can also be determined by a call to first_attribute
or next_attribute.
This function can be used to retrieve both binary and nonbinary attribute values.
This function removes a leaf entry in the LDAP Directory Information Tree.
DBMS_LDAP.delete_s ( ld IN SESSION, entrydn IN VARCHAR2) RETURN PLS_INTEGER;
Parameter Name | Description |
---|---|
|
A valid LDAP session |
|
The X.500 distinguished name of the entry to delete. |
Value | Description |
---|---|
|
|
The function delete_s
can be used to remove only leaf level entries in the LDAP DIT. A leaf level entry is an entry that does not have any children/LDAP entries under it. It cannot be used to delete nonleaf entries.
This function modrdn2_s
can be used to rename the relative distinguished name of an entry.
DBMS_LDAP.modrdn2_s ( ld IN SESSION, entrydn IN VARCHAR2 newrdn IN VARCHAR2 deleteoldrdn IN PLS_INTEGER) RETURN PLS_INTEGER;
Value | Description |
---|---|
|
|
This function can be used to rename the leaf nodes of a DIT. It simply changes the relative distinguished name by which they are known. The use of this function is being deprecated in the LDAP v3 standard. Please use rename_s,
which can achieve the same foundation.
This function converts an LDAP error code to string in the local language in which the API is operating
DBMS_LDAP.err2string ( ldap_err IN PLS_INTEGER ) RETURN VARCHAR2;
Parameter | Description |
---|---|
|
An error number returned from one the API calls. |
Value | Description |
---|---|
|
A character string appropriately translated to the local language which describes the error in detail. |
Exception | Description |
---|---|
N/A |
None. |
In this release, the exception handling mechanism automatically invokes this if any of the API calls encounter an error.
This function allocates memory for array modification entries that are applied to an entry using the modify_s
or add_s
functions.
DBMS_LDAP.create_mod_array ( num IN PLS_INTEGER) RETURN MOD_ARRAY;
Parameter | Description |
---|---|
|
The number of the attributes that you want to add or modify. |
Value | Description |
---|---|
|
The data structure holds a pointer to an LDAP mod array.
|
Exception | Description |
---|---|
N/A |
No LDAP specific exception is raised |
This function is one of the preparation steps for DBMS_LDAP.add_s
and DBMS_LDAP.modify_s.
It is required to call DBMS_LDAP.free_mod_array
to free memory after the calls to add_s
or modify_s
have completed.
This procedure populates one set of attribute information for add or modify operations.
DBMS_LDAP.populate_mod_array ( modptr IN DBMS_LDAP.MOD_ARRAY, mod_op IN PLS_INTEGER, mod_type IN VARCHAR2, modval IN DBMS_LDAP.STRING_COLLECTION);
Value | Description |
---|---|
N/A |
- |
Exception | Description |
---|---|
|
Invalid LDAP mod array. |
|
Invalid LDAP mod option. |
|
Invalid LDAP mod type. |
|
Invalid LDAP mod value. |
This function is one of the preparation steps for DBMS_LDAP.add_s and DBMS_LDAP.modify_s. It has to happen after DBMS_LDAP.create_mod_array is called.
This procedure populates one set of attribute information for add or modify operations. This procedure call has to happen after DBMS_LDAP.create_mod_array is called.
PROCEDURE populate_mod_array (modptr IN DBMS_LDAP.MOD_ARRAY, mod_op IN PLS_INTEGER, mod_type IN VARCHAR2, modval IN DBMS_LDAP.BERVAL_COLLECTION);
Value | Description |
---|---|
N/A |
- |
Exception | Description |
---|---|
|
Invalid LDAP mod array. |
|
Invalid LDAP mod option. |
|
Invalid LDAP mod type. |
|
Invalid LDAP mod value. |
This function is one of the preparation steps for DBMS_LDAP.add_s
and DBMS_LDAP.modify_s.
It has to happen after DBMS_LDAP.create_mod_array
is called.
This function performs a synchronous modification of an existing LDAP directory entry.
DBMS_LDAP.modify_s ( ld IN DBMS_LDAP.SESSION, entrydn IN VARCHAR2, modptr IN DBMS_LDAP.MOD_ARRAY) RETURN PLS_INTEGER;
Value | Description |
---|---|
|
The indication of the success or failure of the modification operation |
Exception | Description |
---|---|
|
Invalid LDAP session. |
|
Invalid LDAP entry dn. |
|
Invalid LDAP mod array. |
This function call has to follow successful calls of DBMS_LDAP.create_mod_array
and DBMS_LDAP.populate_mod_array
.
This function adds a new entry to the LDAP directory sychronously. Before calling add_s,
you must call DBMS_LDAP.create_mod_array and DBMS_LDAP.populate_mod_array
.
DBMS_LDAP.add_s ( ld IN DBMS_LDAP.SESSION, entrydn IN VARCHAR2, modptr IN DBMS_LDAP.MOD_ARRAY) RETURN PLS_INTEGER;
Value | Description |
---|---|
|
The indication of the success or failure of the modification operation. |
Exception | Description |
---|---|
|
Invalid LDAP session. |
|
Invalid LDAP entry dn. |
|
Invalid LDAP mod array. |
The parent entry of the entry to be added must already exist in the directory. This function call has to follow successful calls of DBMS_LDAP.create_mod_array
and DBMS_LDAP.populate_mod_array.
This procedure frees the memory allocated by DBMS_LDAP.create_mod_array.
DBMS_LDAP.free_mod_array ( modptr IN DBMS_LDAP.MOD_ARRAY);
Parameter | Description |
---|---|
|
The handle to an LDAP mod structure, as returned by successful call to |
Value | Description |
---|---|
N/A |
- |
Exception | Description |
---|---|
N/A |
No LDAP specific exception is raised. |
This function counts the number of values returned by DBMS_LDAP.get_values.
DBMS_LDAP.count_values ( values IN DBMS_LDAP.STRING_COLLECTION) RETURN PLS_INTEGER;
Parameter | Description |
---|---|
|
The collection of string values. |
Value | Description |
---|---|
|
The indication of the success or failure of the operation. |
Exception | Description |
---|---|
N/A |
No LDAP specific exception is raised. |
This function counts the number of values returned by DBMS_LDAP.get_values_len.
DBMS_LDAP.count_values_len ( values IN DBMS_LDAP.BINVAL_COLLECTION) RETURN PLS_INTEGER;
Parameter | Description |
---|---|
|
The collection of binary values. |
Value | Description |
---|---|
|
The indication of the success or failure of the operation. |
Exception | Description |
---|---|
N/A |
No LDAP specific exception is raised. |
This function renames an LDAP entry synchronously.
DBMS_LDAP.rename_s ( ld IN SESSION, dn IN VARCHAR2, newrdn IN VARCHAR2, newparent IN VARCHAR2, deleteoldrdn IN PLS_INTEGER, serverctrls IN LDAPCONTROL, clientctrls IN LDAPCONTROL) RETURN PLS_INTEGER;
Value | Description |
---|---|
|
The indication of the success or failure of the operation. |
This function breaks a DN up into its components.
DBMS_LDAP.explode_dn ( dn IN VARCHAR2, notypes IN PLS_INTEGER) RETURN STRING_COLLECTION;
Value | Description |
---|---|
|
An array of strings. If the DN cannot be broken up, |
Exception | Description |
---|---|
|
Invalid LDAP DN. |
|
Invalid LDAP notypes value. |
This function establishes an SSL (Secure Sockets Layer) connection over an existing LDAP connection.
DBMS_LDAP.open_ssl ( ld IN SESSION, sslwrl IN VARCHAR2, sslwalletpasswd IN VARCHAR2, sslauth IN PLS_INTEGER) RETURN PLS_INTEGER;
Value | Description |
---|---|
|
The indication of the success or failure of the operation. |
Call DBMS_LDAP.init
first to acquire a valid LDAP session.
|
Copyright © 2000, 2002 Oracle Corporation. All Rights Reserved. |
|