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

Using LDAP from Mathematica, Part 3

Method written in Part 2 (MathLDAP-02.nb) were followed again.
Descriptions about storing and reading binary data in the entiry were newly added.
OpenLDAP for Linux and Windows were both used.

Junzo SATO

Aug 17th 2001

Installing J/Link

J/Link Mathmatica package is loaded.

[Graphics:Images/mathldap03_gr_1.gif]

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

[Graphics:Images/mathldap03_gr_2.gif]
[Graphics:Images/mathldap03_gr_3.gif]
[Graphics:Images/mathldap03_gr_4.gif]
[Graphics:Images/mathldap03_gr_5.gif]

Initializing LDAP Connection

Controlling Entry

Tools are loaded and defined.

[Graphics:Images/mathldap03_gr_16.gif]
[Graphics:Images/mathldap03_gr_17.gif]
[Graphics:Images/mathldap03_gr_18.gif]
[Graphics:Images/mathldap03_gr_19.gif]

Search by filter.

[Graphics:Images/mathldap03_gr_20.gif]
[Graphics:Images/mathldap03_gr_21.gif]
[Graphics:Images/mathldap03_gr_22.gif]
[Graphics:Images/mathldap03_gr_23.gif]
[Graphics:Images/mathldap03_gr_24.gif]
[Graphics:Images/mathldap03_gr_25.gif]
[Graphics:Images/mathldap03_gr_26.gif]

The above result is the same as the one that LDAP Editor/Browser has retrieved.

[Graphics:Images/mathldap03_gr_27.gif]

[Graphics:Images/mathldap03_gr_28.gif]

Read by DN.

Null password for authentication means anonymous connection.

[Graphics:Images/mathldap03_gr_29.gif]
[Graphics:Images/mathldap03_gr_30.gif]
[Graphics:Images/mathldap03_gr_31.gif]
[Graphics:Images/mathldap03_gr_32.gif]
[Graphics:Images/mathldap03_gr_33.gif]
[Graphics:Images/mathldap03_gr_34.gif]
[Graphics:Images/mathldap03_gr_35.gif]
[Graphics:Images/mathldap03_gr_36.gif]

Compare

[Graphics:Images/mathldap03_gr_37.gif]
[Graphics:Images/mathldap03_gr_38.gif]
[Graphics:Images/mathldap03_gr_39.gif]
[Graphics:Images/mathldap03_gr_40.gif]
[Graphics:Images/mathldap03_gr_41.gif]
[Graphics:Images/mathldap03_gr_42.gif]

Client-side Sort

[Graphics:Images/mathldap03_gr_43.gif]
[Graphics:Images/mathldap03_gr_44.gif]
[Graphics:Images/mathldap03_gr_45.gif]
[Graphics:Images/mathldap03_gr_46.gif]
[Graphics:Images/mathldap03_gr_47.gif]
[Graphics:Images/mathldap03_gr_48.gif]
[Graphics:Images/mathldap03_gr_49.gif]
[Graphics:Images/mathldap03_gr_50.gif]
[Graphics:Images/mathldap03_gr_51.gif]
[Graphics:Images/mathldap03_gr_52.gif]
[Graphics:Images/mathldap03_gr_53.gif]
[Graphics:Images/mathldap03_gr_54.gif]
[Graphics:Images/mathldap03_gr_55.gif]
[Graphics:Images/mathldap03_gr_56.gif]
[Graphics:Images/mathldap03_gr_57.gif]
[Graphics:Images/mathldap03_gr_58.gif]
[Graphics:Images/mathldap03_gr_59.gif]
[Graphics:Images/mathldap03_gr_60.gif]
[Graphics:Images/mathldap03_gr_61.gif]
[Graphics:Images/mathldap03_gr_62.gif]
[Graphics:Images/mathldap03_gr_63.gif]
[Graphics:Images/mathldap03_gr_64.gif]
[Graphics:Images/mathldap03_gr_65.gif]
[Graphics:Images/mathldap03_gr_66.gif]
[Graphics:Images/mathldap03_gr_67.gif]
[Graphics:Images/mathldap03_gr_68.gif]
[Graphics:Images/mathldap03_gr_69.gif]
[Graphics:Images/mathldap03_gr_70.gif]
[Graphics:Images/mathldap03_gr_71.gif]
[Graphics:Images/mathldap03_gr_72.gif]
[Graphics:Images/mathldap03_gr_73.gif]
[Graphics:Images/mathldap03_gr_74.gif]
[Graphics:Images/mathldap03_gr_75.gif]
[Graphics:Images/mathldap03_gr_76.gif]
[Graphics:Images/mathldap03_gr_77.gif]
[Graphics:Images/mathldap03_gr_78.gif]
[Graphics:Images/mathldap03_gr_79.gif]
[Graphics:Images/mathldap03_gr_80.gif]
[Graphics:Images/mathldap03_gr_81.gif]
[Graphics:Images/mathldap03_gr_82.gif]
[Graphics:Images/mathldap03_gr_83.gif]
[Graphics:Images/mathldap03_gr_84.gif]
[Graphics:Images/mathldap03_gr_85.gif]
[Graphics:Images/mathldap03_gr_86.gif]
[Graphics:Images/mathldap03_gr_87.gif]
[Graphics:Images/mathldap03_gr_88.gif]
[Graphics:Images/mathldap03_gr_89.gif]
[Graphics:Images/mathldap03_gr_90.gif]
[Graphics:Images/mathldap03_gr_91.gif]
[Graphics:Images/mathldap03_gr_92.gif]
[Graphics:Images/mathldap03_gr_93.gif]
[Graphics:Images/mathldap03_gr_94.gif]
[Graphics:Images/mathldap03_gr_95.gif]
[Graphics:Images/mathldap03_gr_96.gif]
[Graphics:Images/mathldap03_gr_97.gif]
[Graphics:Images/mathldap03_gr_98.gif]
[Graphics:Images/mathldap03_gr_99.gif]
[Graphics:Images/mathldap03_gr_100.gif]
[Graphics:Images/mathldap03_gr_101.gif]
[Graphics:Images/mathldap03_gr_102.gif]
[Graphics:Images/mathldap03_gr_103.gif]
[Graphics:Images/mathldap03_gr_104.gif]
[Graphics:Images/mathldap03_gr_105.gif]
[Graphics:Images/mathldap03_gr_106.gif]
[Graphics:Images/mathldap03_gr_107.gif]
[Graphics:Images/mathldap03_gr_108.gif]
[Graphics:Images/mathldap03_gr_109.gif]
[Graphics:Images/mathldap03_gr_110.gif]
[Graphics:Images/mathldap03_gr_111.gif]
[Graphics:Images/mathldap03_gr_112.gif]
[Graphics:Images/mathldap03_gr_113.gif]
[Graphics:Images/mathldap03_gr_114.gif]
[Graphics:Images/mathldap03_gr_115.gif]
[Graphics:Images/mathldap03_gr_116.gif]
[Graphics:Images/mathldap03_gr_117.gif]
[Graphics:Images/mathldap03_gr_118.gif]
[Graphics:Images/mathldap03_gr_119.gif]
[Graphics:Images/mathldap03_gr_120.gif]
[Graphics:Images/mathldap03_gr_121.gif]
[Graphics:Images/mathldap03_gr_122.gif]
[Graphics:Images/mathldap03_gr_123.gif]
[Graphics:Images/mathldap03_gr_124.gif]
[Graphics:Images/mathldap03_gr_125.gif]
[Graphics:Images/mathldap03_gr_126.gif]
[Graphics:Images/mathldap03_gr_127.gif]
[Graphics:Images/mathldap03_gr_128.gif]
[Graphics:Images/mathldap03_gr_129.gif]
[Graphics:Images/mathldap03_gr_130.gif]
[Graphics:Images/mathldap03_gr_131.gif]
[Graphics:Images/mathldap03_gr_132.gif]
[Graphics:Images/mathldap03_gr_133.gif]
[Graphics:Images/mathldap03_gr_134.gif]
[Graphics:Images/mathldap03_gr_135.gif]
[Graphics:Images/mathldap03_gr_136.gif]

Add NEW Entry

[Graphics:Images/mathldap03_gr_137.gif]
[Graphics:Images/mathldap03_gr_138.gif]

The NEW entry is added successfully. For simplicity, new entry is added under the ou=Special Users directory.

[Graphics:Images/mathldap03_gr_139.gif]

Add Attribute

AddAttribute[conn,dn,attrname,data] adds an attribute to the existing entry. If the data is exactly same value as the existing attribute, it fails.

[Graphics:Images/mathldap03_gr_140.gif]
[Graphics:Images/mathldap03_gr_141.gif]

New attribute (multivalued attribute) is added successfully.

[Graphics:Images/mathldap03_gr_142.gif]

Replace Attribute

[Graphics:Images/mathldap03_gr_143.gif]
[Graphics:Images/mathldap03_gr_144.gif]

Attribute(s) named "mail" is replaced with new data.

[Graphics:Images/mathldap03_gr_145.gif]

It's possible to replace attribute(s) with multivalues.

[Graphics:Images/mathldap03_gr_146.gif]

The following figure shows the entry after replacement.

[Graphics:Images/mathldap03_gr_147.gif]

Delete Attribute

[Graphics:Images/mathldap03_gr_148.gif]
[Graphics:Images/mathldap03_gr_149.gif]

Surely removed :-)

[Graphics:Images/mathldap03_gr_150.gif]

ModificationSet

[Graphics:Images/mathldap03_gr_151.gif]
[Graphics:Images/mathldap03_gr_152.gif]

Two mails are listed as the result of first modification. The telephoneNumber is removed by replacing old attribute with null. One more mail is added by the final modification.

[Graphics:Images/mathldap03_gr_153.gif]

Binary Record

Storing binary data

The attribute of the entry can maintain binary record directly.

[Graphics:Images/mathldap03_gr_154.gif]
Reading binary data
[Graphics:Images/mathldap03_gr_155.gif]
[Graphics:Images/mathldap03_gr_156.gif]
[Graphics:Images/mathldap03_gr_157.gif]
[Graphics:Images/mathldap03_gr_158.gif]
[Graphics:Images/mathldap03_gr_159.gif]
[Graphics:Images/mathldap03_gr_160.gif]
Data File
[Graphics:Images/mathldap03_gr_161.gif]
[Graphics:Images/mathldap03_gr_162.gif]
[Graphics:Images/mathldap03_gr_163.gif]

The data is stored to the entry.

[Graphics:Images/mathldap03_gr_164.gif]

Now we can see the replaced data. Look at the size of the binary data.

[Graphics:Images/mathldap03_gr_165.gif]

[Graphics:Images/mathldap03_gr_166.gif]
[Graphics:Images/mathldap03_gr_167.gif]

The contents of the data is exactly same before and after the operation.

[Graphics:Images/mathldap03_gr_168.gif]
[Graphics:Images/mathldap03_gr_169.gif]

Finalizing LDAP Connection

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

[Graphics:Images/mathldap03_gr_170.gif]

Removing J/Link

[Graphics:Images/mathldap03_gr_171.gif]
[Graphics:Images/mathldap03_gr_172.gif]
[Graphics:Images/mathldap03_gr_173.gif]

Reference

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


Converted by Mathematica      August 18, 2001