Hi,
Using JDBC driver agaimst MS SQL 2014 amd I have both channels working.

I need to write the picture of users to a separate table. The picture is
a small jpg that is imported and displays correctly in UserApplication.
But when sending the attribute to DB it needs to get converted
correctly.
How do I do this? As far as I can understand we have the picture in
base64sting in eDir.
I tried the base64 decode token and get the result below. I have alsu
looked through the NOVLLIBAJC-JS that we have in the library since I
found the readImage function ther that I use when importing the picture
with a text driver.

Has anyone done this?

Trace snippet:
[12/14/15 14:46:15.082]:AT-IREG ST:Policy returned:
[12/14/15 14:46:15.082]:AT-IREG ST:
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product edition="Advanced" version="4.5.1.0">DirXML</product>
<contact>NetIQ Corporation</contact>
</source>
<input>
<modify cached-time="20151214134503.550Z" class-name="User"
event-id="gfd-pub-13:f7ad6d88-d4c2-4401-bc80-b44585c251fa"
qualified-src-dn="O=data\OU=users\OU=Personal\CN=abed1"
src-dn="\ATIDM\data\users\Personal\abed1" src-entry-id="36664"
timestamp="1450100703#2">
<association
state="associated">ID=69359,table=SKLEMPLOYEE,sche ma=DBO</association>
<modify-attr attr-name="photo">
<add-value>
<value timestamp="1450100703#2"
type="octet">/9j/4AAQSkZJRgABAQEAYABgAAD..... </value>
</add-value>
</modify-attr>
</modify>
</input>
</nds>
[12/14/15 14:46:15.114]:AT-IREG ST:Applying policy:
%+C%14CUpdateEmployee%-C.
[12/14/15 14:46:15.114]:AT-IREG ST: Applying to modify #1.
[12/14/15 14:46:15.114]:AT-IREG ST: Evaluating selection criteria for
rule 'Uppdatera Person med vrden som ej skrivs av SP'.
[12/14/15 14:46:15.114]:AT-IREG ST: (if-op-attr 'SKL-publicerad'
available) = FALSE.
[12/14/15 14:46:15.114]:AT-IREG ST: Rule rejected.
[12/14/15 14:46:15.114]:AT-IREG ST: Evaluating selection criteria for
rule 'Uppdatera Photo med vrden som ej skrivs korrekt av SP'.
[12/14/15 14:46:15.114]:AT-IREG ST: (if-op-attr 'photo' available)
= TRUE.
[12/14/15 14:46:15.114]:AT-IREG ST: Rule selected.
[12/14/15 14:46:15.114]:AT-IREG ST: Applying rule 'Uppdatera Photo
med vrden som ej skrivs korrekt av SP'.
[12/14/15 14:46:15.114]:AT-IREG ST: Action:
do-set-local-variable("varPicture",scope="policy",token-base64-decode(token-attr("photo"))).
[12/14/15 14:46:15.114]:AT-IREG ST:
arg-string(token-base64-decode(token-attr("photo")))
[12/14/15 14:46:15.114]:AT-IREG ST:
token-base64-decode(token-attr("photo"))
[12/14/15 14:46:15.114]:AT-IREG ST:
token-base64-decode(token-attr("photo"))
[12/14/15 14:46:15.114]:AT-IREG ST: token-attr("photo")
[12/14/15 14:46:15.114]:AT-IREG ST: Token Value:
"/9j/4AAQSkZJRgABAQE.......
[12/14/15 14:46:15.160]:AT-IREG ST: Token Value:
"���� JFIF  .............
[12/14/15 14:46:15.239]:AT-IREG ST: Action:
do-set-local-variable("lv_SQLupdate",scope="policy","UPDATE dbo.Picture
"+"SET Data ="+token-local-variable("varPicture")+" "+"WHERE
Id='"+token-attr("workforceID")+"'").
[12/14/15 14:46:15.239]:AT-IREG ST: arg-string("UPDATE
dbo.Picture "+"SET Data ="+token-local-variable("varPicture")+"
"+"WHERE Id='"+token-attr("workforceID")+"'")
[12/14/15 14:46:15.239]:AT-IREG ST: token-text("UPDATE
dbo.Picture ")
[12/14/15 14:46:15.239]:AT-IREG ST: token-text("SET Data =")
[12/14/15 14:46:15.239]:AT-IREG ST:
token-local-variable("varPicture")
[12/14/15 14:46:15.239]:AT-IREG ST: Token Value:
"���� JFIF  .........
[12/14/15 14:46:15.301]:AT-IREG ST: token-text(" ")
[12/14/15 14:46:15.301]:AT-IREG ST: token-text("WHERE Id='")
[12/14/15 14:46:15.301]:AT-IREG ST: token-attr("workforceID")
[12/14/15 14:46:15.301]:AT-IREG ST: Query from policy
[12/14/15 14:46:15.301]:AT-IREG ST:
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product edition="Advanced" version="4.5.1.0">DirXML</product>
<contact>NetIQ Corporation</contact>
</source>
<input>
<query class-name="User" dest-dn="\ATIDM\data\users\Personal\abed1"
dest-entry-id="36664" scope="entry">
<read-attr attr-name="workforceID"/>
</query>
</input>
</nds>
[12/14/15 14:46:15.301]:AT-IREG ST: Pumping XDS to
eDirectory.
[12/14/15 14:46:15.301]:AT-IREG ST: Performing operation
query for \ATIDM\data\users\Personal\abed1.
[12/14/15 14:46:15.301]:AT-IREG ST: --JCLNT--
\ATIDM\system\driverset1\AT-IREG : Duplicating : context = 446169217,
tempContext = 446169171
[12/14/15 14:46:15.301]:AT-IREG ST: --JCLNT--
\ATIDM\system\driverset1\AT-IREG : Calling free on tempContext =
446169171
[12/14/15 14:46:15.301]:AT-IREG ST: Query from policy result
[12/14/15 14:46:15.301]:AT-IREG ST:
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product edition="Advanced" version="4.5.1.0">DirXML</product>
<contact>NetIQ Corporation</contact>
</source>
<output>
<instance class-name="User"
qualified-src-dn="O=data\OU=users\OU=Personal\CN=abed1"
src-dn="\ATIDM\data\users\Personal\abed1" src-entry-id="36664">
<association
state="associated">ID=69359,table=SKLEMPLOYEE,sche ma=DBO</association>
<attr attr-name="workforceID">
<value timestamp="1448629090#52" type="string">69359</value>
</attr>
</instance>
<status level="success"></status>
</output>
</nds>
[12/14/15 14:46:15.301]:AT-IREG ST: Token Value: "69359".
[12/14/15 14:46:15.301]:AT-IREG ST: token-text("'")
[12/14/15 14:46:15.301]:AT-IREG ST: Arg Value: "UPDATE
dbo.Picture SET Data =���� JFIF  ......
WHERE Id='69359'".
..
..
..
[12/14/15 14:46:15.645]:AT-IREG ST:
SubscriptionShim.execute() returned:
[12/14/15 14:46:15.645]:AT-IREG ST:
<nds dtdversion="2.0" ndsversion="8.x" xmlns:jdbc="urn:dirxml:jdbc">
<source>
<product build="20150417_0410" instance="AT-IREG"
version="4.0.1.0">DirXML Driver for JDBC</product>
<contact>NetIQ Corporation</contact>
</source>
<output>
<status event-id="0" level="retry" type="app-connection">
<description>An error occurred executing statement "UPDATE
dbo.Picture SET Data
=����&#xf8ff;&#xf8ef;JFIF.................... ....
<jdbc:exception jdbc:class="java.sql.SQLException"
jdbc:error-code="0" jdbc:sql-state="2A000">
<jdbc:message>Unexpected parameter marker at position
743.</jdbc:message>
</jdbc:exception>
</status>
</output>
</nds>

Thanks


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=54929