I have IDM set up to sync eDir to ID Vault and then to AD but now I am
looking at using database driver as well. First I had a simple application
that works with MySQL on Linux - basically, synching users one way from eDir
to the database. Everything worked Ok and I did not have to dig too deep to
get it to work.

Now I have got this app running on top of MS SQL 2000 database with user
records having two attributes ( among others ) - UserID and some
Thirdparty_Code. User accounts in eDirectory also have values for those
UserID's in their Title attribute. What I now need is to populate
Thirdparty_Code in the database with CN from eDirectory ( for users with
matching UserID's ).

I do not know much about databases. I tried altering sample driver provided
by Novell, added a copy of my table ( StudDetails ) with users to idm
database and then tried setting up a matching rule :

<do-find-matching-object scope="subtree">
<arg-dn>
<token-text xml:space="preserve">StudDetails</token-text>
</arg-dn>
<arg-match-attr name="Title"/>
</do-find-matching-object>

which I thought might find me a db record with the right Title ( that is
being mapped to UserID in StudDetails table in schema mapping policy :

<attr-name-map>
<class-name>
<nds-name>User</nds-name>
<app-name>StudDetails</app-name>
</class-name>
<attr-name class-name="User">
<nds-name>Title</nds-name>
<app-name>StudId</app-name>
</attr-name>
<attr-name class-name="User">
<nds-name>CN</nds-name>
<app-name>ThirdParty_Code</app-name>
</attr-name>
</attr-name-map>

I also have a single attribute to be 'synced' ( eDir to db on Subscriber )
which is CN ( mapped to Thirdparty_Code which is the one I need to replace
with CN's ). I do not need to add any new db records ( not at this stage at
least ), all users should already be in the database. All I need is to
update their Thirdparty_Code accordingly. To test this I am trying to
'Migrate from ID Vault' a single user. Now my trace looks like this :

Message 1:
Wed Jul 11 12:42:07 EST 2007
Warning
<status level="warning">Unable to determine whether retrieval of
auto-generated keys is supported. Defaulting to
false.<application>DirXML</application>
<module>MSSQL-EWS</module>
<object-dn>\IDM_TREE\EMA\Students\AAAUSER</object-dn>
<component>Subscriber</component>
</status>
\IDM_TREE\EMA\Students\AAAUSER

Message 2:
Wed Jul 11 12:42:07 EST 2007
Warning
<status level="warning">Primary key values taken from an event are useful
only before insertion. Overriding key generation timing from 'after' to
'before' for table/view 'dbo.StudDetails'.<application>DirXML</application>
<module>MSSQL-EWS</module>
<object-dn>\IDM_TREE\EMA\Students\AAAUSER</object-dn>
<component>Subscriber</component>
</status>
\IDM_TREE\EMA\Students\AAAUSER

Message 3:
Wed Jul 11 12:42:08 EST 2007
Error
<status event-id="C-NDS#20070711024206#99#1" level="error"
type="driver-general">
<description>Unable to add object. Unable to retrieve primary key value(s)
from event. Event missing required value for primary key column
'dbo.StudDetails.StudId'.</description>
<object-dn>O=EMA\OU=Students\CN=AAAUSER</object-dn>
<jdbc:document xml:space="preserve" xmlns:jdbc="urn:dirxml:jdbc">&lt;nds
dtdversion="3.5" ndsversion="8.x">
&lt;source>
&lt;product version="3.5.0.20070315 ">DirXML&lt;/product>
&lt;contact>Novell, Inc.&lt;/contact>
&lt;/source>
&lt;input>
&lt;add class-name="dbo.StudDetails" event-id="C-NDS#20070711024206#99#1"
qualified-src-dn="O=EMA\OU=Students\CN=AAAUSER"
src-dn="\IDM_TREE\EMA\Students\AAAUSER" src-entry-id="33879">
&lt;add-attr attr-name="ThirdParty_Code">
&lt;value naming="true" timestamp="1143179739#181"
type="string">AAAUSER&lt;/value>
&lt;/add-attr>
&lt;/add>
&lt;/input>
&lt;/nds></jdbc:document>
<application>DirXML</application>
<module>MSSQL-EWS</module>
<component>Subscriber</component>
</status>
\IDM_TREE\EMA\Students\AAAUSER

Am I doing this completely wrong ? as it seems it is trying to add a new db
record then fails to retrieve pk which it should not even be doing, right ..
as I want it to update an existing one ( which I need to find first ).

There are other ways to achieve this but I guess I'd like it done the hard
( for me ) way. Any ideas are much appreciated, sorry for a lengthy post
Andrew