Home | History | Annotate | Line # | Download | only in docs
      1  1.1  lukem PLEASE READ THIS WHOLE FILE AND CONCEPT, BECAUSE THEY COVER SEVERAL STICKY
      2  1.1  lukem ISSUES THAT YOU WILL PROBABLY STUMBLE ACROSS ANYWAY
      3  1.1  lukem 
      4  1.1  lukem 1. Build
      5  1.1  lukem To build slapd with back-sql under Unix you need to build and install
      6  1.1  lukem iODBC 2.50.3 (later versions should probably work, but not earlier),
      7  1.1  lukem or unixODBC (you will have to change -liodbc to -lodbc then).
      8  1.1  lukem Then, at top of OpenLDAP source tree, run
      9  1.1  lukem "configure <other options you need> --enable-sql", then "make" -
     10  1.1  lukem this should build back-sql-enabled slapd, provided that you have iODBC/unixODBC
     11  1.1  lukem libraries and include files in include/library paths, "make install"...
     12  1.1  lukem In other words, follow installation procedure described in OpenLDAP 
     13  1.1  lukem Administrators Guide, adding --enable-sql option to configure, and
     14  1.1  lukem having iODBC/unixODBC libraries installed an accessible by compiler.
     15  1.1  lukem 
     16  1.1  lukem Under Win32/MSVC++, I modified the workspace so that back-sql is built into
     17  1.1  lukem slapd automatically, since MS ODBC manager, odbc32.dll, is included in
     18  1.1  lukem standard library pack, and it does no bad even if you don't plan to use it.
     19  1.1  lukem I also could provide precompiled executables for those who don't have MSVC.
     20  1.1  lukem Note that Win32 port of OpenLDAP itself is experimental, and thus doesn't
     21  1.1  lukem provide very convenient build environment (yet).
     22  1.1  lukem 
     23  1.1  lukem 2. Tune datasources and slapd.conf
     24  1.1  lukem Next, you need to define ODBC datasource with data you want to publish
     25  1.1  lukem with help of back-sql. Assuming that you have your data in some SQL-compliant
     26  1.1  lukem RDBMS, and have installed proper ODBC driver for this RDBMS, this is as simple
     27  1.1  lukem as adding a record into odbc.ini (for iODBC/unixODBC), or using ODBC wizard in
     28  1.1  lukem Control Panel (for odbc32).
     29  1.1  lukem Next, you need to add appropriate "database" record to your slapd.conf.
     30  1.1  lukem See samples provided in "back-sql/RDBMS_DEPENDENT/" subdirectory. 
     31  1.1  lukem 
     32  1.1  lukem Several things worth noting about ODBC:
     33  1.1  lukem - "dbname" directive stands for ODBC datasource name (DSN),
     34  1.1  lukem   not the name of your database in RDBMS context
     35  1.1  lukem - ODBC under Unix is not so common as under Windows, so you could have
     36  1.1  lukem   problems with Unix drivers for your RDBMS. Visit http://www.openlinksw.com,
     37  1.1  lukem   they provide a multitier solution which allows connecting to DBMSes on
     38  1.1  lukem   different platforms, proxying and other connectivity and integration issues.
     39  1.1  lukem   They also support iODBC, and have good free customer service through
     40  1.1  lukem   newsserver (at news.openlinksw.com).
     41  1.1  lukem   Also worth noting are: ODBC-ODBC bridge by EasySoft (which was claimed
     42  1.1  lukem    by several people to be far more effective and stable than OpenLink),
     43  1.1  lukem    OpenRDA package etc.
     44  1.1  lukem - be careful defining RDBMS connection parameters, you'll probably need only
     45  1.1  lukem   "dbname" directive - all the rest can be defined in datasource. Every other
     46  1.1  lukem   directive is used to override value stored in datasource definition.
     47  1.1  lukem   Maybe you will want to use dbuser/dbpasswd to override credentials defined in datasource
     48  1.1  lukem - full list of configuration directives supported is available in file "guide",
     49  1.1  lukem   you may also analyze output of 'slapd -d 5' to find out some useful 
     50  1.1  lukem   directives for redefining default queries 
     51  1.1  lukem 
     52  1.1  lukem 3. Creating and using back-sql metatables
     53  1.1  lukem Read the file "concept" to understand, what metainformation you need to add,
     54  1.1  lukem and what for... ;)
     55  1.1  lukem See SQL scripts and slapd.conf files in samples directory.
     56  1.1  lukem Find subdirectory in "rdbms_depend/" corresponding to your RDBMS (Oracle,
     57  1.1  lukem MS SQL Server and mySQL are listed there currently), or copy and edit
     58  1.1  lukem any of these to conform to SQL dialect of your RDBMS (please be sure to send
     59  1.1  lukem me scripts and notes for new RDBMSes ;).
     60  1.1  lukem 
     61  1.1  lukem Execute "backsql_create.sql" from that subdirectory (or edited one),
     62  1.1  lukem so that the tables it creates appear in the same
     63  1.1  lukem context with the data you want to export through LDAP (under same DB/user, 
     64  1.1  lukem or whatever is needed in RDBMS you use). You can use something like
     65  1.1  lukem "mysql < xxx.sql" for mySQL, Query Analyzer+Open query file for MS SQL,
     66  1.1  lukem sqlplus and "@xxx.sql" for Oracle.
     67  1.1  lukem 
     68  1.1  lukem You may well want to try it with test data first, and see how metatables
     69  1.1  lukem are used. Create test data and metadata by running testdb_create.sql,
     70  1.1  lukem testdb_data.sql, and testdb_metadata.sql scripts (again, adopted for your
     71  1.1  lukem RDBMS, and in the same context as metatables you created before), and
     72  1.1  lukem tune slapd.conf to use your test DB.
     73  1.1  lukem 
     74  1.1  lukem 4. Testing
     75  1.1  lukem To diagnose back-sql, run slapd with debug level TRACE ("slapd -d 5" will go).
     76  1.1  lukem Then, use some LDAP client to query corresponding subtree (for test database,
     77  1.1  lukem you could for instance search one level from "o=sql,c=RU"). I personally used
     78  1.1  lukem saucer, which is included in OpenLDAP package (it builds automatically under
     79  1.1  lukem Unix/GNU configure and for MSVC I added appropriate project to workspace).
     80  1.1  lukem And also Java LDAP browser-editor (see link somewhere on OpenLDAP site) to
     81  1.1  lukem test ADD/DELETE/MODIFY operations on Oracle and MS SQL.
     82  1.1  lukem 
     83  1.1  lukem See file "platforms" if you encounter connection problems - you may find
     84  1.1  lukem a hint for your RDBMS or OS there. If you are stuck - please contact me at
     85  1.1  lukem mit (a] openldap.org, or (better) post an issue through OpenLDAP's Issue Tracking
     86  1.1  lukem System (see http:/www.openldap.org/its).
     87