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