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 » Coverting CLOB data to XML

Post new topic  Reply to topic
 Coverting CLOB data to XML « View previous topic :: View next topic » 
Author Message
satnam
PostPosted: Wed Dec 31, 2003 7:04 am    Post subject: Coverting CLOB data to XML Reply with quote

Newbie

Joined: 20 May 2003
Posts: 7

I am trying to Save XML data as CLOB in Database and later trying to retrieve CLOB and convert it back to XML

I am able to Save the XML as CLOb successfully using following Code


SAVE THE MESSAGE using
=================
DECLARE bContent BLOB;
SET bContent = ASBITSTREAM("Body") ;

INSERT INTO Database.TABLEX(
RECORDTYPE,SOURCERECORDID , XMLDATA)
VALUES (Type, RecordId, bContent);

Later I am trying to retrieve the information back from database and convert back to XML


Get the Message using
==============
SET Environment.TMP.MyData = THE (SELECT ITEM M.XMLDATA FROM Database.ISESUSPENSE AS M WHERE M.RECORDTYPE = Type
AND M.SOURCERECORDID = RecordId);

CREATE FIRSTCHILD OF Environment.TMP.TRAN Domain('XML') PARSE(Environment.TMP.MyData);

SET OutputRoot.XML = Environment.TMP.TRAN.XML;

SET Environment.TMP = NULL;


But I get the following error in the trace

An attempt was made to cast the character string
'<?xml version="1.0" encoding="UTF-8"?><CUSTOMER><OFFICE>123</OFFICE></CUSTOMER>' to a byte string,
but the string was of the wrong format. There must be an even number of hexadecimal digits (0-9, a-f, A-F).


Please advise

Thanks
Back to top
View user's profile Send private message
Michael Dag
PostPosted: Wed Dec 31, 2003 7:16 am    Post subject: Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2607
Location: The Netherlands (Amsterdam)

I think this is what you are looking for:
http://www.mqseries.net/phpBB2/viewtopic.php?t=1976&highlight=store+retrieve+xml+database

Michael
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
satnam
PostPosted: Wed Dec 31, 2003 8:04 am    Post subject: Reply with quote

Newbie

Joined: 20 May 2003
Posts: 7

MY DB field is defined as CLOB ? Can't use BLOB as it's too small.

When I use:
SET OutputRoot."BLOB"."BLOB" = CAST(THE (SELECT ITEM (M.XMLDATA) FROM Database.ISESUSPENSE AS M WHERE M.RECORDTYPE = Type
AND M.SOURCERECORDID = RecordId) AS BLOB);

I get the following error
RecoverableException BIP2521E: (27, 32) : Error casting a value from CHARACTER to BLOB.
An error occurred when casting a value of data type CHARACTER to a value of data type BLOB.
Subsequent messages will indicate the context of the error.
2003-12-31 09:57:15.253999 276 RecoverableException BIP2590E: Error casting character string '<?xml version="1.0" encoding="UTF-8"?><CUSTOMER><OFFICE>123</OFFICE</CUSTOMER>' to a byte string.

This is rather urgent and all help most appreciated.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Dec 31, 2003 8:14 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Add a CCSID parameter to the CAST.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
satnam
PostPosted: Wed Dec 31, 2003 12:33 pm    Post subject: Reply with quote

Newbie

Joined: 20 May 2003
Posts: 7

Thanks It worked
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Coverting CLOB data to XML
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.