Highlighted

Storing and retrieving an xml variable in DB

kc

28-05-2008

Hi all,



I am having some trouble storing and retrieving an xml variable in a custom DB. Can it be done via the jdbc-services or do I need to create some custom code which I call in an execute script?



In either case, how?



Thanks in advance



Sincerely

Kim Christensen

Replies

Highlighted

Jasmin_Charbonn

28-05-2008

"Can it be done via the jdbc-services?"

Yes



You might want to store it in a String variable if you run into problem with the XML.



Jasmin
Highlighted

kc

28-05-2008

Ok, thanks alot...



I just had the problem that I didn't get any data inserted in the database.



I have set up the execute sql service to the following:



SQL Statement:



insert into table1 values({$ /process_data/@id $}, '{$ /process_data/formdata $}')



This inserts the processInstanceID in the DB but no data is inserted. I have also tried:



insert into table1 values({$ /process_data/@id $}, {$ /process_data/formdata $}) (without the quotes (' and '))



But this time the server gets an exception parsing the xml.



How should I set up the SQL statement to insert my xml-variable "formdata" into the DB?



Thank you in advance



Sincerely

Kim Christensen
Highlighted

pguerett

28-05-2008

That is because you are not referencing your form data correctly. How is formdata defined? Are you doing this from a submitted form (through workspace)?
Highlighted

Jasmin_Charbonn

28-05-2008

You might have to convert it into a string.



Use the function serialize(/process_data/formdata) to have a string representation of you XML.



Jasmin
Highlighted

kc

28-05-2008

The form is submitted by email and the process is kicked of by an email endpoint. How should I reference my formdata variable?



\Kim
Highlighted