|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
save messageID to databse |
« View previous topic :: View next topic » |
Author |
Message
|
crayon_coco |
Posted: Mon Oct 20, 2003 2:11 am Post subject: save messageID to databse |
|
|
 Apprentice
Joined: 08 Oct 2003 Posts: 33
|
hi!
after put the message into the queue, how do i save the messageID which is a type of byte array into the database eg. sql server?
should i convert it into string first? |
|
Back to top |
|
 |
rwa |
Posted: Mon Oct 20, 2003 3:50 am Post subject: |
|
|
Voyager
Joined: 22 Jan 2002 Posts: 76 Location: Duesseldorf/Germany
|
Hi cocolua,
the field MsgID has the format MQBYTE24. This field should be copied into a binary/blob field of a database. A MsgID field cannot be converted into a string field.
With microsoft sql server the field format binary[24] or varbinary[24] can be used.
Regards,
Rainer |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Oct 20, 2003 5:27 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
rwa wrote: |
the field MsgID has the format MQBYTE24. |
This is true.
rwa wrote: |
This field should be copied into a binary/blob field of a database. |
This is only true for some application designs.
Quote: |
A MsgID field cannot be converted into a string field. |
This is not true at all. Yes, it's true that a MessageID field can (and will, if generated by MQSeries) contain "non-printable"/"non-string" characters. But it's very easy to encode those so they can be stored in a string field. Particularly in VisualBasic, you can ask for the MessageIdHex property, which will give you a 48-character string that contains the hex encoding of the MessageId.
rwa wrote: |
With microsoft sql server the field format binary[24] or varbinary[24] can be used. |
Or, a char[48]. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
rwa |
Posted: Mon Oct 20, 2003 6:32 am Post subject: |
|
|
Voyager
Joined: 22 Jan 2002 Posts: 76 Location: Duesseldorf/Germany
|
Just to complete my picture (I do not know VisualBasic),
is it possible decode string into the binary format?
How does this encoding work? This would be helpful if the database should be read with another programming language. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Oct 20, 2003 6:59 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
rwa wrote: |
Just to complete my picture (I do not know VisualBasic),
is it possible decode string into the binary format?
How does this encoding work? This would be helpful if the database should be read with another programming language. |
Well, in Visual Basic, you can use the various ...Hex properties (MessageIdHex, CorrelIdHex, AccountingTokenHex,...) properties as both "getters" and "setters". That is, I can insert the value of MessageIdHex into a table, and then later on retrieve that value and put it back into MessageIdHex.
But you can do byte to hex character conversions in any language. You just go through each byte, and figure out what the hex representation of that byte value is, and append those two characters to a string.
And a lot of programming environments have presupplied code to do this for you. _________________ I am *not* the model of the modern major general. |
|
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
|
|
|
|