Storing and retrieving an xml variable in DB

Avatar

Avatar

kc

Avatar

kc

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

Avatar

Avatar

Jasmin_Charbonn

Avatar

Jasmin_Charbonn

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

Avatar

Avatar

kc

Avatar

kc

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

Avatar

Avatar

pguerett

Avatar

pguerett

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)?

Avatar

Avatar

Jasmin_Charbonn

Avatar

Jasmin_Charbonn

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

Avatar

Avatar

kc

Avatar

kc

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

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

28-05-2008

What is the variable type tha is recieving the submitted data? XML?

Avatar

Avatar

kc

Avatar

kc

kc

05-09-2008

Sorry for the late post - I got it working at last but just inserting the xml as a string into the db



Kim