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 » Handle XML in Java

Post new topic  Reply to topic Goto page Previous  1, 2
 Handle XML in Java « View previous topic :: View next topic » 
Author Message
mqjeff
PostPosted: Fri Aug 19, 2016 4:00 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
He is not talking about it. He transformed the byte[] into a String. My guess is that he is sending a String downstream to the DB and the DB must know how to handle a Java String...


I think it would be the JDBC infrastructure or the JDBC provider on the broker side that did that... Not the database...
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
newbee001
PostPosted: Fri Aug 19, 2016 7:39 am    Post subject: Reply with quote

Novice

Joined: 04 Aug 2016
Posts: 10

Yes, you are right. Sending byte[] to DB2 doesn't works for XML datatype, but string does.

I've a question, if my 'emp' data received from mainframe in EBCDIC format, applying the below hard coded encoding/ccsid is correct? Shouldnt I use the queue manager's encoding and ccsid format, covert to byte stream and then apply UTF-8 to store in DB2? please clarify.

byte[] mybytes=(byte[]) emp.toBitstream(null, null, null, 546, 1208, 0);
String empStr = new String(mybytes,"UTF-8");
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Aug 19, 2016 7:51 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If you're working in Broker, then you don't have an data in EBCDIC.

You have a logical message tree that's been converted to 1200 (1202?)
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
newbee001
PostPosted: Fri Aug 19, 2016 9:24 am    Post subject: Reply with quote

Novice

Joined: 04 Aug 2016
Posts: 10

Jeff,

In this case, should I assume safely that we dont need to bother about encoding for inbound message from ANY SYSTEM received in broker, but only when generating outbound messages (say to mainframe - MRM/CWF format), need to apply the relevant encoding and CCSID settings?

Also does the below coding sounds more appropriate than hardcoding CCSID as 1208? Covert to byte stream by applying inbound message ccsid and create string message in UTF-8 format. Please clarify.


byte[] mybytes = (byte[]) emp.toBitstream(null, null,
null, 0, inboundCCSID, 0);
empstring = new String(mybytes, "UTF-8");

Thanks in advance.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Aug 20, 2016 5:32 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

newbee001 wrote:
Jeff,

In this case, should I assume safely that we dont need to bother about encoding for inbound message from ANY SYSTEM received in broker, but only when generating outbound messages (say to mainframe - MRM/CWF format), need to apply the relevant encoding and CCSID settings?

Also does the below coding sounds more appropriate than hardcoding CCSID as 1208? Covert to byte stream by applying inbound message ccsid and create string message in UTF-8 format. Please clarify.


byte[] mybytes = (byte[]) emp.toBitstream(null, null,
null, 0, inboundCCSID, 0);
empstring = new String(mybytes, "UTF-8");

Thanks in advance.

Again, you're grasping at straws and don't understand what you're doing.
Assume the inbound CCSID is 500. (EBCDIC international)
So you are building a byte[] in ccsid 500 and expect java to be able to give a String when you pass the byte[] and tell it it is in UTF-8?

I'd like to borrow some of that stuff you've been drinking!!!
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Sat Aug 20, 2016 9:56 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

fjb_saper wrote:

Again, you're grasping at straws and don't understand what you're doing.
Assume the inbound CCSID is 500. (EBCDIC international)
So you are building a byte[] in ccsid 500 and expect java to be able to give a String when you pass the byte[] and tell it it is in UTF-8?



Sadly, this is not that uncommon. Many people have a hard time understanding CCID's and Encoding. For many devs it is not something that they have ever encountered before they do so with Broker.
When I introduce people to IIB I spend at least two hours talking about CCSID's and using examples of what happens when you get it wrong.

Timber (as kimbert) has posted in the past some links to some articles that do help explain it very well.
It takes a while to get your heady) around it but when you do... you wonder why you had problems in the first place.

Getting devs to understand how (or why you would ever want to) change from UTF-8 to UTF-16LE in the middle of a message is another matter entirely.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Handle XML in Java
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.