|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Coverting CLOB data to XML |
« View previous topic :: View next topic » |
Author |
Message
|
satnam |
Posted: Wed Dec 31, 2003 7:04 am Post subject: Coverting CLOB data to XML |
|
|
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 |
|
 |
Michael Dag |
Posted: Wed Dec 31, 2003 7:16 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
|
Back to top |
|
 |
satnam |
Posted: Wed Dec 31, 2003 8:04 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Wed Dec 31, 2003 8:14 am Post subject: |
|
|
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 |
|
 |
satnam |
Posted: Wed Dec 31, 2003 12:33 pm Post subject: |
|
|
Newbie
Joined: 20 May 2003 Posts: 7
|
|
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
|
|
|
|