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 IndexWebSphere Message Broker SupportStore an XML into Sybase By IIB

Post new topicReply to topic
Store an XML into Sybase By IIB View previous topic :: View next topic
Author Message
Mandrake90
PostPosted: Tue Feb 11, 2020 4:23 am Post subject: Store an XML into Sybase By IIB Reply with quote

Newbie

Joined: 11 Feb 2020
Posts: 3

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
View user's profile Send private message
Vitor
PostPosted: Tue Feb 11, 2020 8:28 am Post subject: Re: Store an XML into Sybase By IIB Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25920
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
View user's profile Send private message
timber
PostPosted: Wed Feb 12, 2020 2:35 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1097

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
View user's profile Send private message
Mandrake90
PostPosted: Wed Feb 12, 2020 4:13 am Post subject: Re: Store an XML into Sybase By IIB Reply with quote

Newbie

Joined: 11 Feb 2020
Posts: 3

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
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportStore an XML into Sybase By IIB
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.