OpenLDAP & backSQL
Foster, ThomasX
thomasx.foster at intel.com
Wed Apr 28 14:40:24 PDT 2004
I hope this is the right list to post this question, so please correct
me if not
I have read quite a bit of documentation on setting up OpenLDAP with
back-SQL, using libiODBC and MyODBC to connect to MySQL. In an attempt
to get this running myself, I started by compiling these ports in this
order:
mysql-server-4.0.18_1 --> mysql-client-4.0.18_1
openldap-server-2.1.30 (--enable-sql=YES) --> openldap-client-2.1.30
libiodbc-3.51.1_4
myodbc-3.51.06
I created a MySQL database called "ldap", and granted all privileges on
it to a user called "ldap" with a password. I then imported the SQL
schema from the OpenLDAP rdbms_depend directory into the MySQL database
successfully. I can connect to the database as the "ldap" user and
successfully view and augment the "ldap" database.
I then proceeded to configure my "slapd.conf" with the following
information:
############################## SLAPD.CONF
###############################################
# $OpenLDAP:
pkg/ldap/servers/slapd/back-sql/rdbms_depend/mysql/slapd.conf,v 1.3
2001/08/02 15:28:59 mit Exp $
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
# Define global ACLs to disable default read access.
# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org
pidfile /usr/local/var/slapd.pid
argsfile /usr/local/var/slapd.args
loglevel 32
#######################################################################
# sql database definitions
#######################################################################
database sql
suffix "o=sql,c=RU"
rootdn "cn=root,o=sql,c=RU"
rootpw secret
dbname ldap
dbuser ldap
dbpasswd password
oc_query "SELECT
id,name,keytbl,keycol,create_proc,delete_proc,expect_ret
urn FROM ldap_oc_mappings"
at_query "SELECT
name,sel_expr,from_tbls,join_where,add_proc,delete_proc,
param_order,expect_return FROM ldap_attr_mappings WHERE oc_map_id=?"
subtree_cond "ldap_entries.dn LIKE CONCAT('%',?)"
insentry_query "INSERT INTO ldap_entries (dn,oc_map_id,parent,keyval)
VALUES (?
,?,?,?)"
delentry_query "DELETE FROM ldap_entries WHERE id=?"
strcast_func "text"
concat_pattern "?||?"
I configured "/usr/local/etc/libiodbc/odbc.ini" with the following
information:
######################### ODBC.INI
##############################################
[ODBC Data Sources]
ldap = MySQL LDAP DSN
[ldap]
Driver = /usr/local/lib/libmyodbc3.so
Description = OpenLDAP Database
Host = localhost
ServerType = MySQL
Port = 3306
FetchBufferSize = 99
UserName = ldap
Password = password
Database = ldap
ReadOnly = no
Socket = /var/lib/mysql/mysql.sock
[ODBC]
InstallDir=/usr/local/lib
When I go to manually start "slapd", I get the following output:
slapd startup: initiated.
==>backsql_db_open(): testing RDBMS connection
backsql_db_open(): setting 'ldap_entries.dn=?' as default
==>backsql_get_db_conn()
==>backsql_open_db_conn()
backsql_open_db_conn: SQLConnect() to database 'ldap' as user 'ldap'
failed:
Return code: -1
Native error code: 2005
SQL engine state: S1000
Message: [MySQL][ODBC 3.51 Driver]Unknown MySQL Server Host '' (1)
backsql_get_db_conn(): could not get connection handle -- returning NULL
backsql_db_open(): connection failed, exiting
backend_startup: bi_db_open(0) failed! (1)
slapd shutdown: initiated
==>backsql_db_close()
<==backsql_db_close()
slapd shutdown: freeing system resources.
==>backsql_db_destroy()
==>backsql_free_db_env()
<==backsql_free_db_env()
==>destroy_schema_map()
<==destroy_schema_map()
<==backsql_db_destroy()
slapd stopped.
I have tried running iodbctest and checking the DSN=ldap, and I get the
following error:
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.51.0001.0908
Enter ODBC connect string (? shows list): DSN=ldap
[MySQL][ODBC 3.51 Driver]Unknown MySQL Server Host '(
The test then stops.. and I must Ctrl+C to quit out of it. This leads
me to believe I have configured the ODBC incorrectly. I had moved the
odbc.ini file to /usr/local/etc/ and have even tried exporting the
ODBCINI variable pointing to the path of odbc.ini, but this has not
seemed to help the situation. I get the following from iodbctest:
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.51.0001.0908
Enter ODBC connect string (? shows list): ?
DSN | Description
---------------------------------------------------------------
ldap | MySQL LDAP DSN
Enter ODBC connect string (? shows list): DSN=ldap
[MySQL][ODBC 3.51 Driver]Can't connect to local MySQL server through
socket '/var/lib/mysql/mysql.sock' (2), SQLSTATE=HY000
When I remove the socket statement from the "odbc.ini" I get the
following error:
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.51.0001.0908
Enter ODBC connect string (? shows list): DSN=ldap
[MySQL][ODBC 3.51 Driver]Access denied for user: 'dummy at localhost'
(Using password: YES), SQLSTATE=HY000
I feel this is an obvious configuration issue, but I cannot seem to find
anymore information on the subject. Any suggestions? Any input is
appreciated. Thanks
Thomas Foster
http://www.section6.net <http://www.section6.net/>
"In a world without fences or walls, there is no need for Gates or
Windows."
More information about the freebsd-questions
mailing list