ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » inserting InputRoot into DB2 [windows]

Post new topic  Reply to topic
 inserting InputRoot into DB2 [windows] « View previous topic :: View next topic » 
Author Message
ryzor
PostPosted: Thu Feb 17, 2005 7:21 am    Post subject: inserting InputRoot into DB2 [windows] Reply with quote

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
View user's profile Send private message Send e-mail
Craig B
PostPosted: Mon Feb 21, 2005 1:48 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Mon Feb 21, 2005 4:54 am    Post subject: Reply with quote

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
View user's profile Send private message
ryzor
PostPosted: Mon Feb 21, 2005 6:34 am    Post subject: Reply with quote

Apprentice

Joined: 31 Dec 2001
Posts: 42

Thanx,

i implemented the suggestion and it worked.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » inserting InputRoot into DB2 [windows]
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.