OpenLDAP‘s back-sql offers an SQL schema which you can use (and modify) to serve as a slapd back-end. This is most useful when you want to provide access to data within an SQL database through the LDAP protocol.
It is said using an SQL database as a general purpose slapd back-end would be very unsatisfying performance-wise. SQL backing an LDAP directory is primarily recommended if you want to make existing data in an SQL database available to LDAP clients without having to duplicate data and efforts.
back-sql works by mapping LDAP operations to SQL database statements.
Searching an LDAP tree is very different than searching an SQL database. As in an SQL SELECT statement, an LDAP search operation can be constrained with a given set of conditions called LDAP search filters. Also as in SQL, the names of attributes to include in the search result can be given. LDAP without
The SQL query to retrieve the mappings of LDAP object classes to SQL relations is configured by oc_query configuration directive. The default query is “SELECT id, name, keytbl, keycol, create_proc, delete_proc, expect_return FROM ldap_oc_mappings“. The following is the table structure which fits this default query. This is also the table structure which is created if you use the standard schema from the OpenLDAP CVS repository.
id INTEGER UNIQUEid is the unique numeric identifier of an objectClass mapping.name VARCHAR(64)name is the name of the objectClass.keytbl VARCHAR(64)keytbl is the name of the table (or view) where entries of this object class are to be found.keycol VARCHAR(64)keycol is the name of the column in keytbl that holds the primary key.create_proc VARCHAR(255)create_proc VARCHAR(255)expect_return INTEGERI’ve found the combination of OpenLDAP’s backsql, iODBC/UnixODBC and PostgreSQL to be extremely fragile and unreliable. Once, on a particular system, it would work. But, I’ve never been able to reproduce this even though I’ve tried it with different versions of OpenLDAP, *ODBC and Postgres. — Rowan Rodrik van der Molen 2006/07/22 15:28