[lsc-users] two questions about lsc and db synchronization

jckidder at aep.com jckidder at aep.com
Thu Jan 17 15:13:59 CET 2013


Natan, I'm assuming you're truncating the full name because of 
restrictions imposed by an application??  You won't be able to manipulate 
the pivot attribute before it is used in evaluations.  Instead, why don't 
you create a second arbitrary field in your table that  contains the 
complete full name and use that as your pivot attribute?  You can then 
simply manage the field that contains the truncated name as an ordinary 
attribute.  Even if you could manipulate the pivot attribute you couldn't 
use truncated full name because the pivot attribute or combination of 
pivot attributes must define a unique record. 

-Jon C. Kidder
American Electric Power
Middleware Services
614-716-4970



Natan Sanson <nsanson at gmail.com> 
Sent by: lsc-users-bounces at lists.lsc-project.org
01/17/2013 07:55 AM

To
lsc-users at lists.lsc-project.org
cc

Subject
[lsc-users] two questions about lsc and db synchronization






Hi, I have two doubts about lsc capabilities. 

I'm trying to synchronize an ldap source with a jdbc destionation. The 
destination is a MYSQL and I'm trying to populate mysql.user table. 

1)
I'm able to to the synchronization but the "User" field is a Char(16). In 
the source configuration I want to use the ldap attribute "fullName" as 
pivotAttribute.  To create all the user entries I have to force the values 
and insert only the first 16 chars.

<dataset>
<name>fullName</name>
<policy>KEEP</policy>
<forceValues>
<string>
var result = ""; 
if (srcBean.getDatasetFirstValueById("fullName").length() > 15) result = 
srcBean.getDatasetFirstValueById("fullName").substring(0,16); 
else result = srcBean.getDatasetFirstValueById("fullName"); result;
</string>
</forceValues>
</dataset>
<dataset>
 
This works as expected but then if i launch a second time the "lsc -s 
all", the process compare the entire fullName as pivot attribute and retry 
to create the trimmed entry, giving error.

Is there any way to manipulate the pivotAttribute before comparing it with 
the destination source?

My SqlMap

<sqlMap namespace="InetOrgPerson">
<select id="getInetOrgPersonList" resultClass="java.util.HashMap">
<!-- SELECT pers.User AS id -->
SELECT User AS fullName FROM user
</select>
<select id="getInetOrgPerson" resultClass="java.util.HashMap" parameterClass="java.util.Map">
SELECT User as fullName, Password as userPassword FROM user WHERE User = 
#fullname#
</select>
<insert id="insertInetOrgPerson" parameterClass="java.util.Map">
INSERT INTO user 
(Host,User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Create_user_priv,Event_priv,Trigger_priv,ssl_type,ssl_cipher,x509_issuer,x509_subject,max_questions,max_updates,max_connections,max_user_connections) 
VALUES 
('localhost',#fullname#,"defaulthashedpassword",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','','0','0','0','0')
</insert>
<update id="updateInetOrgPerson" parameterClass="java.util.Map">
UPDATE user SET Password=PASSWORD(#userpassword#) WHERE User=#fullname#
</update>
<delete id="deleteInetOrgPerson" parameterClass="java.util.Map">
....
</delete>
</sqlMap>

I know this isn't a best practice because username should be unique and a 
truncation can generate multiple associations with the same mysql user, 
but this is only for test purpose


2) during the update, I'm not able to instruct a "FLUSH PRIVILEGES" 
command to mysql via lsc. Is there any way to send it via lsc? Should I 
write a stored procedure in mysql? But in this case, is lsc able to handle 
stored procedure calls?


Thanks in advance for any help

     Natan_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
lsc-users at lists.lsc-project.org
http://lists.lsc-project.org/listinfo/lsc-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lsc-project.org/pipermail/lsc-users/attachments/20130117/e6ce97bd/attachment-0001.htm>


More information about the lsc-users mailing list