2. Installation

This Howto was first written (Aug 2001) using OpenLDAP 2.1.12, PostgreSQL 7.3.1 and iODBC 3.0.6. These was the versions that I've tested and turn in production state.

I don't use it anymore but I still maintain support on this howto and my last installation was on SlackWare 13.0, OpenLDAP 2.4.21, PostgreSQL 8.4.3, unixODBC 3.2.0 and psqlodbc 08.04.0200 in April 2010.

2.1. PostgreSQL

PostgreSQL can be found at http://www.postgresql.org/.

See the PostgreSQL HOWTO if you don't know about PostgreSQL installation. You don't need any special configuration option to have LDAP working on your database now that the PostgreSQL ODBC library is external to PostgreSQL distribution. See next chapters.

2.2. UnixODBC vs iODBC

After have passed some time to have iODBC (libiodbc 3.52.7) working with last versions of OpenLDAP (2.4.21) and psql-odbc (08.04.0200) I recommand the use of UnixODBC (2.3.0). This was the only workaround I found of an OpenLDAP hang/block at backsql_load_schema_map() call (run slapd -d -1) and the error message "ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)" during a ldapsearch with libiodbc 3.52.7.

Using UnixODBC works fine and I did not have time to fix libiodbc or OpenLDAP on the SQLAllocStmt failure, so I still put here the libiodbc installation instruction for older/later used or debuging purpose but at this time you can jump to unixODBC installation.

libiodbc installation:


	./configure --with-iodbc-inidir=/etc
	make
	make install

UnixODBC installation:


	./configure
	make
	make install

This will install the libodbc into /usr/local/lib and the ODBC Library will search for the odbc.ini and odbcinst.ini into /usr/local/etc. Remember the last path for later use in this howto.

2.3. PostgreSQL ODBC Driver

The PostgreSQL ODBC driver can be found at psqlODBC - The PostgreSQL ODBC Driver.

Install libpsqlodbc with unixODBC:


	./configure --with-unixodbc=/usr/local
	make
	make install

Install libpsqlodbc with libiodbc:


	./configure --with-iodbc --with-odbcinst=/etc
	make
	make install

If you have the error: "configure: error: libpq library not found", try to add --with-libpq=/usr/local/pgsql/ to the configure command.

If you need full ODBC support with PostgreSQL take a look at the odbc.sql file. It contains some compatibility SQL function. Here we don't need it at all.

2.4. OpenLDAP

OpenLDAP can be found at http://www.openldap.org/. You need to compile OpenLDAP with the --enable-sql option.
Here is what I use to install OpenLDAP:


	./configure --enable-sql --without-cyrus-sasl --disable-bdb --enable-crypt --disable-hdb
	make depend
	make
	make install

Here options --without-cyrus-sasl and --disable-bdb/--disable-hdb are used to remove Cyrus Sasl authentication support and the use of a Berkeley DB backend that could break the OpenLDAP configuration phase.

If you use crypt password use the --enable-crypt configuration option else you will never be allowed to authenticate with ldap.

If configure complain about sql.h not found, remember that you have to install ODBC support before.