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 » General IBM MQ Support » Converting String To BLOB and ViceVersa In JavaCompute Node.

Post new topic  Reply to topic
 Converting String To BLOB and ViceVersa In JavaCompute Node. « View previous topic :: View next topic » 
Author Message
SandiSan
PostPosted: Fri Dec 08, 2006 7:23 am    Post subject: Converting String To BLOB and ViceVersa In JavaCompute Node. Reply with quote

Acolyte

Joined: 01 Apr 2006
Posts: 57
Location: Pune/India

Hi All,

I want to convert MQMD->MsgId that is comming as BLOB to String and also do the reverse conversion in JavaCompute.This is what i have tried.

1. Converting MsgId in BLOB to String
// Getting MsgId from MQMD
MbElement msgId = outMessage.getRootElement().getFirstChild().getNextSibling().getFirstElementByPath("MsgId");
// Converting MsgId to String
String sMsgId = msgId.getValue().toString();

But the String value what i am getting is : [B@70089286.

2. Converting String Id in BLOB.
Here i want to achieve the flollowing in JavaCompute InputRoot"."MQMD"."MsgId" = CAST('MYOWNMSGID' AS BLOB); that we can do in Compute Node using ESQL . I tried
// Getting MsgId from Input Messge
MbElement msgidval= inMsg.getFirstElementByPath("MsgId");
// Getting BLOB value to MQMD/MsgId
mbMqmdMsgId.setValue(msgidval.getValue().getBytes());

Regards
SandiSan
Back to top
View user's profile Send private message Yahoo Messenger
kevinf2349
PostPosted: Fri Dec 08, 2006 7:32 am    Post subject: Reply with quote

Grand Master

Joined: 28 Feb 2003
Posts: 1311
Location: USA

Search this site with BLOB and MSGID as search words. I think this was answered some time ago.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Dec 08, 2006 7:41 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Also, you don't want to do this.

You should change the sending application so that it doesn't try and use a transport header that is defined to only hold byte values, to store business information.

Do not use MsgId to hold strings. Do not use MsgId to hold "information".
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
SandiSan
PostPosted: Fri Dec 08, 2006 9:53 am    Post subject: Reply with quote

Acolyte

Joined: 01 Apr 2006
Posts: 57
Location: Pune/India

@kevinf2349
We can easily convert STRING-BLOB in ComputeNode. But i want to do it in Java Compute Node.

@jefflowrey
I guess i may have confused you.Actually my scenario is i have MsgId stored as String and i want to reterive that value and set it to MQMD-->MsgId. Since MQMD-->MsgId Datatype is BLOB i am stuck with converting String-To-BLOB In JavaCompute Node

Regards
Sandisan.
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Fri Dec 08, 2006 10:37 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

getValue will return a byte[] if the element is a BLOB element.

getValue will return a String if the element is a CHARACTER element.

setValue will accept a byte[] or a String.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
billybong
PostPosted: Sun Dec 10, 2006 1:54 pm    Post subject: Reply with quote

Disciple

Joined: 22 Jul 2005
Posts: 150
Location: Stockholm, Sweden

What you're probably looking for is to represent byte data in HEX format, which means as strings. Google for "byte to string HEX conversion" and you'll probably find some piece of code that does just that.
_________________
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Integration Developer V6.0
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere DataPower
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Converting String To BLOB and ViceVersa In JavaCompute Node.
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.