Currently, example source codes for some of the LDAP client
utilities for basic LDAP operations like add, modify delete, search,
and modrdn are provided both in C and Java™, which can be used to build your own version
of these LDAP client utilities.
The Java classes for each
of these operations use JNDI APIs for doing the operations on directory
server. The Java classes for
the LDAP client utilities are provided in the
DS_INSTALL_ROOT/examples/java directory.
Note: Javadoc
HTML documentation for the extended operations and controls are zipped
into TDSJNDIToolkitJavaDocs.zip and is available
in the DS_INSTALL_ROOT/javalib directory.
The following LDAP client utilities in Java are available in the
examples/java directory:
- LDAPAdd – To add LDAP entries to the server.
- LDAPModify – To modify LDAP entries on the
server.
- LDAPDelete – To delete LDAP entries from the
server.
- LDAPModRDN – To modify the RDN or DN of the
entries on the server.
- LDAPExop – To run extended operations on the
server.
- LDAPSearch – To search entries on the server.
The LDAP client utilities are compiled as Java class files. The table lists Java class files that are associated with their
corresponding LDAP clients:
Table 1. LDAP clients and corresponding Java classes| LDAP clients |
Java class
file |
| LDAPAdd |
com.ibm.ldap.bp.client.ldapadd.LDAPAdd |
| LDAPModify |
com.ibm.ldap.bp.client.ldapmodify.LDAPModify |
| LDAPDelete |
com.ibm.ldap.bp.client.ldapdelete.LDAPDelete |
| LDAPModRDN |
com.ibm.ldap.bp.client.ldapmodrdn.LDAPModRDN |
| LDAPExop |
com.ibm.ldap.bp.client.ldapexop.LDAPExop |
| LDAPSearch |
com.ibm.ldap.bp.client.ldapsearch.LDAPSearch |
To run the LDAP clients, you require IBM® Java 5 or latter versions. For the
LDAP clients to run, the class path must be correct and the path of
the JAR files must be provided in the class path. The JAR files,
TDSJNDIToolkit.jar and
IBMLDAPJavaBer.jar are
available in the
DS_INSTALL_ROOT/javalib directory.
Note: To
make Java clients to work over
SSL and with key database files (with kdb extension),
register a security provider for reading CMS in the java.security file.
To compile the source files to a wanted location, you can use the
build script available in the DS_INSTALL_ROOT/examples/java directory.
On Windows platform, the
build script is provided as a batch file, build.bat,
and on UNIX platforms, it is
provided as a shell script, build.sh.
To run the script on UNIX platform,
enter the following command at command prompt:
# ./build.sh
This
script compiles all the LDAP Java clients
to the bin folder. To run the script with parameters, check the usage
instructions for the script by providing
“-?” on Windows platform and
“--help” on UNIX platform.
After the clients are compiled at the default location,
DS_INSTALL_ROOT/examples/java/bin,
the following command can be used to display the
LDAPAdd client
usage on a UNIX platform:
# pwd /opt/ibm/ldap/V6.3.1/examples/java/bin
# ../../../java/bin/java -classpath
.:../../../javalib/TDSJNDIToolkit.jar:../../../javalib/IBMLDAPJavaBer.jar com.\
ibm.ldap.bp.client.ldapadd.LDAPAdd -?