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

Re: sql-backend



hi pierangelo!

Pierangelo Masarati wrote:

hi adam!

work your sql-backend?

Adam Williams wrote:


as you could read is my config not working but i will help and me :).
...



load_schema_map(): at_query 'SELECT
name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u
FROM ldap_attr_mappings WHERE oc_map_id=?' load_schema_map():
objectClass 'inetOrgPerson' is not defined in schema
==>backsql_free_db_conn()



Are you includeing /etc/openldap/schema/inetorgperson.schema in slapd.conf?



yes, but i see ...

[...]
==>backsql_add(): adding entry 'dc=sql,dc=hosting'
oc_check_required entry (dc=sql,dc=hosting), objectClass "dcObject"
oc_check_required entry (dc=sql,dc=hosting), objectClass "organization"
oc_check_allowed type "objectClass"
oc_check_allowed type "o"
oc_check_allowed type "dc"
oc_check_allowed type "structuralObjectClass"
oc_check_allowed type "entryUUID"
oc_check_allowed type "creatorsName"
oc_check_allowed type "createTimestamp"
oc_check_allowed type "entryCSN"
oc_check_allowed type "modifiersName"
oc_check_allowed type "modifyTimestamp"
backsql_add(): cannot determine objectclass of entry -- aborting


In your ldap_oc_mappings there's no way
to find how to map the entry you provided
to an objectClass that is known to your
back-sql instance.


the straing thing is that the other database works great with db 4.1.



this has REALLY nothing to do with back-sql: the entry you're using can be totally fine, compliant with the latest (or backward compatible with the earliest) LDAP standard, but if the back-sql doesn't know how to store it in the RDBMS there's no way it can work.

back-bdb stores the entries internally, so
as soon as they're fine the always get stored.

I assume, from wehat you're stating, that you
never had a look at slapd-sql(5), which clearly
statesm, in its opening:

       The primary purpose of this slapd(8) backend is to PRESENT
       information stored in some RDBMS as an LDAP subtree  with-
       out  any programming (some SQL and maybe stored procedures
       can't be considered programming, anyway ;).

       ...

       It is NOT designed as a general-purpose backend that  uses
       RDBMS  instead  of BerkeleyDB (as the standard BDB backend
       does), though it can be used as such with several  limita-
       tions.    You   can   take  a  look  at  http://www.openl-
       dap.org/faq/index.cgi?file=378 (OpenLDAP  FAQ-O-Matic/Gen-
       eral  LDAP  FAQ/Directories vs. conventional databases) to
       find out more on this point.


ok, read it.

>>> dnPrettyNormal: <cn=Manager,dc=my,dc=hosting>
=> ldap_bv2dn(cn=Manager,dc=my,dc=hosting,0)
<= ldap_bv2dn(cn=Manager,dc=my,dc=hosting,0)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=Manager,dc=my,dc=hosting,272)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=manager,dc=my,dc=hosting,272)=0
<<< dnPrettyNormal: <cn=Manager,dc=my,dc=hosting>,
<cn=manager,dc=my,dc=hosting>
do_bind: version=3 dn="cn=Manager,dc=my,dc=hosting" method=128
==> bdb_bind: dn: cn=Manager,dc=my,dc=hosting
bdb_dn2entry_rw("cn=manager,dc=my,dc=hosting")
=> bdb_dn2id_matched( "cn=manager,dc=my,dc=hosting" )
====> bdb_cache_find_entry_dn2id("dc=my,dc=hosting"): 1 (1 tries)
====> bdb_cache_find_entry_id( 1 ) "dc=my,dc=hosting" (found) (1 tries)
====> bdb_cache_return_entry_r( 1 ): returned (0)
do_bind: v3 bind: "cn=Manager,dc=my,dc=hosting" to
"cn=Manager,dc=my,dc=hosting"
send_ldap_result: conn=9 op=0 p=3
send_ldap_result: err=0 matched="" text=""
send_ldap_response: msgid=1 tag=97 err=0
ber_flush: 14 bytes to sd 12


i build the mysql database with backsql_create.sql what ever there must be the problem!


Apparently, you didn't load the meta-data.
"backsql_create.sql" populates an example RDBMS
__BEFORE__ it is back-sql enabled.  You need
to populate the back-sql aware portion of the
database with "testdb_metadata.sql" before you
even run slapd with any instance of back-sql.

when i do this the slapd would not come up :(.

slapd startup: initiated.
bdb_db_open: dc=my,dc=hosting
bdb_db_open: dbenv_open(/var/lib/openldap-data)
==>backsql_db_open(): testing RDBMS connection
backsql_db_open(): concat func not specified (use "concat_pattern" directive in slapd.conf)
backsql_db_open(): setting 'ldap_entries.dn=?' as default
backsql_db_open(): objectclass mapping SQL statement not specified (use "oc_query" directive in slapd.conf)
backsql_db_open(): setting 'SELECT id,name,keytbl,keycol,create_proc,delete_proc,expect_return FROM ldap_oc_mappings' by default
backsql_db_open(): attribute mapping SQL statement not specified (use "at_query" directive in slapd.conf)
backsql_db_open(): setting 'SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?' by default
backsql_db_open(): entry deletion SQL statement not specified (use "delentry_query" directive in slapd.conf)
backsql_db_open(): setting 'DELETE FROM ldap_entries WHERE id=?' by default
==>backsql_get_db_conn()
==>backsql_open_db_conn()
backsql_open_db_conn(): connected, adding to tree
<==backsql_open_db_conn()
backsql_get_db_conn(): first call -- reading schema map
==>load_schema_map()
ldapinfo.dn_ru field exists in the schema
load_schema_map(): at_query 'SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?'
load_schema_map(): objectClass 'inetOrgPerson': keytbl='persons' keycol='id'
create_proc='insert into persons (name) values ('');
select last_insert_id();'
expect_return: add=0, del=0; attributes:
load_schema_map(): autoadding 'objectClass' and 'ref' mappings
load_schema_map(): error executing at_query:
Return code: -1
Native error code: 1054
SQL engine state: S0022
Message: [unixODBC][MySQL][ODBC 3.51 Driver][mysqld-4.0.16]Unknown column 'sel_expr_u' in 'field list'
==>backsql_free_db_conn()
backsql_free_db_conn(): closing db connection
==>backsql_close_db_conn()
<==backsql_close_db_conn()
<==backsql_free_db_conn()
backsql_db_open(): connection failed, exiting
backend_startup: bi_db_open(1) failed! (1)
slapd shutdown: initiated
====> bdb_cache_release_all
==>backsql_db_close()
<==backsql_db_close()
slapd shutdown: freeing system resources.
====> bdb_cache_release_all
==>backsql_db_destroy()
==>backsql_free_db_env()
<==backsql_free_db_env()
==>destroy_schema_map()
==>free_oc(): 'inetOrgPerson'
==>free_attr(): 'ref'
<==free_attr()
==>free_attr(): 'objectClass'
<==free_attr()
<==free_oc()
<==destroy_schema_map()
<==backsql_db_destroy()
slapd stopped.
connections_destroy: nothing to destroy.


:(.

This is clearly described in slapd-sql(5) under the "METAINFORMATION USED", although, I admit, the "testdb_metadata.sql" is never explicitly mentioned (sig!). In any case, crafting meta- data for back-sql is not a simple exercise, so I wouldn't suggest to start playing with slapd by using back-sql, and significantly by trying to load the database from scratch using add operations!

It is very unlikely you can write your meta-data
in order to entirely load a database, even for
a very simple example.  Writing thru back-sql
should be an exception; routine writes should
occur directly in the RDBMS.

I hope I was clear enough.

ok, i the slapd-sql now and i think it's clear now. i use the BerkeleyDB for working and the copy the informations the sql that i need :).


than it works but not with the testdb.
p.


otto

--
-----------------------------------
Otto Kucera
A-1020 Wien Engerthstrasse 137/6/7
Tel: +43 699 1 942 30 91 [neue Nummer!]
Email: ok@72pixel.at
Icq: 65351173
-----------------------------------

And root said rm -rf /     ......and there was nothing
*BSD is like a wigwam: NO windows, NO gates and an Apache inside!

Your mailserver MUST resolve properly (Fully Qualified Domain Name) or the mail will not go through!