|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
inserting InputRoot into DB2 [windows] |
« View previous topic :: View next topic » |
Author |
Message
|
ryzor |
Posted: Thu Feb 17, 2005 7:21 am Post subject: inserting InputRoot into DB2 [windows] |
|
|
Apprentice
Joined: 31 Dec 2001 Posts: 42
|
Hi guys,
how can i insert the whole incoming XML msg into a db2 database, by a stmt
UPDATE Database.TATXML as X
SET WHOLETREE = cast(InputBody as char)
WHERE X.DUMMY = '1';
________________________________________________________________
i've tried, SET WHOLETREE = InputRoot.XML,
SET WHOLETREE = InputBody.XML
nothing seems to work, is there a working way that i can impliment? |
|
Back to top |
|
 |
Craig B |
Posted: Mon Feb 21, 2005 1:48 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
When you reference InputBody, this is a message tree field that has both its own value, and represents a message tree/subtree. When field references are used in ESQL, then it is dependent on the function it is used in as to whether the field value or whole tree it represent is considered. Since you have used the field reference in the CAST function and this can only CAST one value, then the value of the specific field is used. In this case the value of InputBody itself is used, which will be implicitly NULL.
What you want in this case is the bitstream that the message tree represents. Therefore you should use the ASBITSTREAM function to serialise the message tree. If you are attempting serialise an input XML message, then you could try something like :
Code: |
DECLARE msgBody BLOB ASBITSTREAM(InputBody, InputProperties.Encoding, InputProperties.CodedCharSetId);
DECLARE charMsgBody CHAR CAST(msgBody AS CHAR CCSID InputProperties.CodedCharSetId);
|
I have written this as two separate statements to help show the two stages, but you can combine this into one statement if you want to by casting the immediate result of the ASBITSTREAM function.
Hope this helps. _________________ Regards
Craig |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 21, 2005 4:54 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
And if you had spent a few minutes searching, you would have found all of the other times this question has been asked and answered with "Use ASBITSTREAM".
Then instead of having to wait until Monday for an answer to a question posted on Thursday (adjusted for my local time, sorry)... You would have had an answer the same day, and possibly in only a few minutes. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ryzor |
Posted: Mon Feb 21, 2005 6:34 am Post subject: |
|
|
Apprentice
Joined: 31 Dec 2001 Posts: 42
|
Thanx,
i implemented the suggestion and it worked.  |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|