[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Working openLDAP with mySQL as backend, but still two questions



Alexander Schuppisser wrote:

Hi people,

I have to access existing data in a mySQL-DB with LDAP and try to
achieve this with OpenLDAP, iODBC and backend-sql und Linux. Took me
some time to find out, that only the postgres-sql-scripts under
servers/slapd/back-sql/rdbms_depend/pgsql are actively maintained and
that their counterpart (.../mysql) for mySQL were having missing fields
etc. I then changed the mysql-sql-scripts according to the pgsql-scripts
(plus the example slapd.conf) and have now a working OpenLDAP with mySQL
as backend. Yuppiee!

A side note:
During this work I realized, that mySQL cannot support write access over
backend-mysql like postgresql because it doesn't have stored procedures
(and mySQL v. 5's "stored procedure" are not really worth beeing called
 that and not even able to do a SELECT). Foutunately, I only want to
have read-access to my DB over LDAP :-)

I have two questions now:

1) To whom can I send the fixs mysql-sql-scripts and the sample
slapd.conf in servers/slapd/back-sql/rdbms_depend/pgsql to check in to CVS?


2) One problem still bugs me when querying openldap with mysql as
backend, although it doesn't seem to influence the outcome of the query:
When I do a
#> ldapsearch -b "o=sql,c=RU" "(objectClass=*)"
with slapd startet with -d 5, I have at multiple places in th output the
following sql-error:

--snip--
==>backsql_get_attr_vals(): oc="inetOrgPerson" attr="ref" keyval=3
backsql_get_attr_values(): error executing attribute query "SELECT
ldap_referrals.url AS ref FROM persons WHERE persons.id=? AND
ldap_entries.id=ldap_referrals.entry_id and
ldap_entries.keyval=persons.id and ldap_entries.oc_map_id=1"
Return code: -1
   Native error code: 1109
   SQL engine state:  S1000
   Message:           [MySQL][ODBC 3.51 Driver][mysqld-4.0.20]Unknown
table 'ldap_referrals' in field list
--snap--

The SQL statement fails, because it cannot return fields from the
(existing) table "ldap_referrals" without including this table in the
FROM-clause. Unfortunately, I can't imagine where I could fix this in
the sql-scripts or slapd.conf :-(. Even when I create a DB without the
two last SQL-statements in my adapted mysql/testdb_metadata.sql, e.g.
without ...

insert into ldap_entry_objclasses (entry_id,oc_name) values (4,'referral');

... and ...

insert into ldap_referrals (entry_id,url) values (4,'ldap://localhost/');

..., nothing changes :-(.

Can someone help me with 1) or 2)?

Thanx
Xa

MySQL scripts have been recently upgraded, and the code in HEAD should now address issue 2 as well. Moreover, in HEAD there are a couple of sql-testXXX tests that are run by the test suite if the SLAPD_USE_SQL macro is set to the appropriate RDBMS (and an existing instance of that RDBMS is properly fed with the data in the test suite). Currently supported RDBMSes are IBM db2, MySQL and PostgreSQL. Of course, MySQL doesn't support (yet) the write test. Please test and report any inconvenience. If you still find anything missing, and you want to provide fixes or improvements, please follow directions at http://www.openldap.org/devel/contributing.html and file an ITS with a reference to your patch.

p.




SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497