Copyright (c) 2001, Junzo SATO. All rights reserved.

Using LDAP from Mathematica

Mathematica can handle Internet Directories using J/Link. In this notebook, how to access LDAP server from Mathematica is demonstrated.

Junzo SATO

Aug 11th 2001

Preparation

OpenLDAP, the directory server application is installed on Linux (and Windows).

The instructions for setting up the server and configuration files are described on the web site:
http://fc.kuh.kumamoto-u.ac.jp/~jsato/ldapmemo/ldapsetup.htm.

The following operations were done based on this environment.

Installing J/Link

J/Link Mathmatica package is loaded.

[Graphics:Images/mathldap_gr_1.gif]

InstallJava[ ] setups J/Link environment so that the Mathmatica can use Java. Options varies depending on which machine and operating system a user is using.

[Graphics:Images/mathldap_gr_2.gif]
[Graphics:Images/mathldap_gr_3.gif]
[Graphics:Images/mathldap_gr_4.gif]

LDAPConnection

Tools

[Graphics:Images/mathldap_gr_5.gif]
[Graphics:Images/mathldap_gr_6.gif]
[Graphics:Images/mathldap_gr_7.gif]
[Graphics:Images/mathldap_gr_8.gif]

A connection to the LDAP server is established. By default, LDAP server uses port number 389.

LDAP Connection

Connection to the LDAP server is created. In this example, localhost is used for convenience.

[Graphics:Images/mathldap_gr_9.gif]
[Graphics:Images/mathldap_gr_10.gif]
[Graphics:Images/mathldap_gr_11.gif]
[Graphics:Images/mathldap_gr_12.gif]
[Graphics:Images/mathldap_gr_13.gif]
[Graphics:Images/mathldap_gr_14.gif]

Connection to the LDAP server is closed. This is essentially the same as ldapconn@finalize[ ].

[Graphics:Images/mathldap_gr_15.gif]

ldapsearch

Now the connection is established again.

[Graphics:Images/mathldap_gr_16.gif]
[Graphics:Images/mathldap_gr_17.gif]
[Graphics:Images/mathldap_gr_18.gif]

'Login' to the directory.

[Graphics:Images/mathldap_gr_19.gif]
[Graphics:Images/mathldap_gr_20.gif]
[Graphics:Images/mathldap_gr_21.gif]

Tools are loaded and defined.

[Graphics:Images/mathldap_gr_22.gif]
[Graphics:Images/mathldap_gr_23.gif]
[Graphics:Images/mathldap_gr_24.gif]

The top directory and it's attribute 'dc' is searched and shown.

[Graphics:Images/mathldap_gr_25.gif]
[Graphics:Images/mathldap_gr_26.gif]
[Graphics:Images/mathldap_gr_27.gif]
[Graphics:Images/mathldap_gr_28.gif]
[Graphics:Images/mathldap_gr_29.gif]
[Graphics:Images/mathldap_gr_30.gif]

Removing J/Link

[Graphics:Images/mathldap_gr_31.gif]
[Graphics:Images/mathldap_gr_32.gif]
[Graphics:Images/mathldap_gr_33.gif]

Reference

[1] Rob Weltman and Tony Dahbura, "LDAP Programming with Java", Addison-Wesley, 2000

The mathematica code is written based on this informative book.


Converted by Mathematica      August 11, 2001