1 Author: Pierangelo Masarati <ando@OpenLDAP.org>
3 Back-sql can be tested with test031-sql; it requires a bit of work to get
4 everything up and running appropriately.
6 This document briefly describes the steps that are required to prepare
7 a quick'n'dirty installation of back-sql and of the related RDBMS
8 and ODBC; Examples are provided, but by no means they pretent
9 to represent an exaustive source of info about how to setup the ODBC;
10 refer to the docs for any problem or detail.
12 Currently, the system has been tested with PostgreSQL and with MySQL;
13 basic support and test data for other RDBMSes is in place, but as of
14 today (August 2004) it's totally untested. If you succeed in running
15 any of the other RDBMSes, please provide feedback about any required
16 change either in the code or in the test scripts by means of OpenLDAP's
17 Issue Tracking System (http://www.openldap.org/its/).
19 1) slapd must be compiled with back-sql support, i.e. configure
20 with --enable-sql switch. This requires an implementation of the ODBC
23 2) The ODBC must be set up appropriately, by editing the odbc.ini file
24 in /etc/ (or wherever your installation puts it) and, if appropriate,
25 the odbcinst.ini file. Note: you can also use custom odbc.ini and
26 odbcinst.ini files, provided you export in ODBCINI the full path to the
27 odbc.ini file, and in ODBCSYSINI the directory where the odbcinst.ini
29 Relevant info for our test setup is highlighted with '<===' on the right.
33 2.1.1) Add to the odbc.ini file a block of the form
36 Description = Example for OpenLDAP's back-sql
39 Database = example <===
40 Servername = localhost
41 UserName = manager <===
42 Password = secret <===
52 2.1.2) Add to the odbcinst.ini file a block of the form
55 Description = ODBC for PostgreSQL
56 Driver = /usr/lib/libodbcpsql.so
57 Setup = /usr/lib/libodbcpsqlS.so
62 2.2.1) Add to the odbc.ini file a block of the form
65 Description = Example for OpenLDAP's back-sql
68 Database = example <===
69 Servername = localhost
70 UserName = manager <===
71 Password = secret <===
78 SOCKET = /var/lib/mysql/mysql.sock
80 2.2.2) Add to the odbcinst.ini file a block of the form
83 Description = ODBC for MySQL
84 Driver = /usr/lib/libmyodbc.so
89 3) The RDBMS must be setup; examples are provided for my installations
90 of PostgreSQL and MySQL, but details may change; other RDBMSes should
91 be configured in a similar manner, you need to find out the details by
92 reading their documentation.
96 3.1.1) Start the server
98 [root@localhost]# service postgresql start
99 on other systems: read the docs...
101 3.1.2) Create the database:
102 [root@localhost]# su - postgres
103 [postgres@localhost]$ createdb example
105 3.1.3) Create the user:
106 [root@localhost]# su - postgres
107 [postgres@localhost]$ psql example
108 example=> create user manager with password 'secret';
109 example=> <control-D>
111 3.1.4) Populate the database:
112 [root@localhost]# cd $SOURCES/servers/slapd/back-sql/rdbms_depend/pgsql/
113 [root@localhost]# psql -U manager -W example
114 example=> <control-D>
115 [root@localhost]# psql -U manager example < backsql_create.sql
116 [root@localhost]# psql -U manager example < testdb_create.sql
117 [root@localhost]# psql -U manager example < testdb_data.sql
118 [root@localhost]# psql -U manager example < testdb_metadata.sql
121 [root@localhost]# cd $SOURCES/tests
122 [root@localhost]# SLAPD_USE_SQL=postgres ./run test031
126 3.2.1) Start the server
128 [root@localhost]# service mysqld start
129 on other systems: read the docs...
131 3.2.2) Create the database:
132 [root@localhost]# mysqladmin -u root -p create example
133 (hit <return> for the empty password).
135 3.2.3) Create the user:
136 [root@localhost]# mysql -u root -p example
137 (hit <return> for the empty password)
138 mysql> grant all privileges on *.* \
139 to 'manager'@'localhost' identified by 'secret' with grant option;
142 3.2.4) Populate the database:
143 [root@localhost]# cd $SOURCES/servers/slapd/back-sql/rdbms_depend/mysql/
144 [root@localhost]# mysql -u manager -p example < backsql_create.sql
145 [root@localhost]# mysql -u manager -p example < testdb_create.sql
146 [root@localhost]# mysql -u manager -p example < testdb_data.sql
147 [root@localhost]# mysql -u manager -p example < testdb_metadata.sql
150 [root@localhost]# cd $SOURCES/tests
151 [root@localhost]# SLAPD_USE_SQL=mysql ./run test031
155 3.3.1) Start the server:
157 3.3.2) Create the database:
159 3.3.3) Create the user:
161 3.3.4) Populate the database:
162 connect to the database as user manager, and execute the test files
163 in auto-commit mode (-c)
164 [root@localhost]# su - manager
165 [manager@localhost]$ db2 "connect to example user manager using secret"
166 [manager@localhost]$ db2 -ctvf backsql_create.sql
167 [manager@localhost]$ db2 -ctvf testdb_create.sql
168 [manager@localhost]$ db2 -ctvf testdb_data.sql
169 [manager@localhost]$ db2 -ctvf testdb_metadata.sql
170 [manager@localhost]$ db2 "connect reset"
173 [root@localhost]# cd $SOURCES/tests
174 [root@localhost]# SLAPD_USE_SQL=ibmdb2 ./run test031
177 The basic portion of the test is readonly; this is performed by all RDBMSes.
178 The secondary part involves write operations. Currently, the write
179 portion of the test is enabled only for PostgreSQL and IBM db2.
180 Note that after a successful run of the write portion, the database is
181 no longer in the correct state to restart the test, and step 3.X.4 needs