|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Store an XML into Sybase By IIB |
« View previous topic :: View next topic » |
Author |
Message
|
Mandrake90 |
Posted: Tue Feb 11, 2020 4:23 am Post subject: Store an XML into Sybase By IIB |
|
|
Novice
Joined: 11 Feb 2020 Posts: 10
|
Hi all,
it's my first topic here but I have been reading you for long time
As subject, I have a Sybase DB with no XML license, so I can't use CML datatype.
I'm able to write my XML on an IMAGE column with this code...
Code: |
DECLARE inCCSID INT 850;
DECLARE inEncoding INT 273;
DECLARE msgBitStream BLOB ASBITSTREAM(Environment.MessageXML, inEncoding, inCCSID);
INSERT INTO Database.dbo.IIB_LOG_T (PAYLOAD_IN)
VALUES (msgBitStream);
|
... but I can't see it correctly or retrieve it with another msgFlow
I also tried to CAST the msgBitStream as CHAR, putting into a Varchar Column but it saves the message with a kind of header (i can read the Queue Manager Name and a lot of strange character)
Is there a saint here that can help me to store and read an XML into a Sybase DB?
 |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 11, 2020 8:28 am Post subject: Re: Store an XML into Sybase By IIB |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Mandrake90 wrote: |
Is there a saint here that can help me to store and read an XML into a Sybase DB?
 |
Saints are in short supply round here but I'll take a crack.
How about base64 encoding the XML and then adding it? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
timber |
Posted: Wed Feb 12, 2020 2:35 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
Is there a saint here...? |
Adjusts halo, straightens wings...
Quote: |
it saves the message with a kind of header (i can read the Queue Manager Name and a lot of strange character) |
That sounds like an MQMD header. Did you copy the entire InputRoot into Environment.messageXML? If so, you may want to copy InputRoot.XMLNSC instead.
Quote: |
I also tried to CAST the msgBitStream as CHAR, putting into a Varchar Column |
I was going to suggest that. If you remove the MQMD, then the XML is just characters and it will probably make your life easier if you store characters in the DB. |
|
Back to top |
|
 |
Mandrake90 |
Posted: Wed Feb 12, 2020 4:13 am Post subject: Re: Store an XML into Sybase By IIB |
|
|
Novice
Joined: 11 Feb 2020 Posts: 10
|
Vitor wrote: |
How about base64 encoding the XML and then adding it? |
Thanks Vitor,
I write succesfully on DB field with this code:
Code: |
DECLARE inCCSID INT 850;
DECLARE inEncoding INT 273;
DECLARE msgBitStream BLOB ASBITSTREAM(Environment.Message, inEncoding, inCCSID);
DECLARE encodedBS CHARACTER BASE64ENCODE(msgBitStream);
INSERT INTO Database.schema.TABLE(PAYLOAD) VALUES (encodedBS);
|
The problem raise when I try to read the message from the DB:
Code: |
DECLARE sqlqry CHAR 'SELECT TS.PAYLOAD FROM schema.TABLE TS WHERE TS.ID=1';
SET Environment.DBRes =PASSTHRU(sqlqry);
DECLARE DBChar CHARACTER CAST(Environment.DBRes.PAYLOAD AS CHARACTER CCSID 850);
DECLARE decoded CHARACTER BASE64DECODE(DBChar);
|
In Debug when I see "DBChar" or "decoded" Variables they seems to be still encoded.
I'll try even the timber's solution but now I'm fixed on base64  |
|
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
|
|
|
|