Author |
Message
|
m.schneider |
Posted: Thu Jul 19, 2007 6:48 am Post subject: Save input msg as BLOB and restoring it |
|
|
Centurion
Joined: 10 Apr 2007 Posts: 132 Location: Germany
|
Hi,
I'm trying to save my input msg to a database and later to retrieve it, ...
While saving I don't get any errors.
-- DB Definition MSG_BACKUP BLOB(2K)
DECLARE msgBitStream BLOB InputRoot.BLOB.BLOB;
INSERT INTO Database.tmp.MESSAGE(MSG_BACKUP)
VALUES ( msgBitStream);
When I try to read the msg from the database the msg I receive an error from the outputnode that the msg is empty
CALL CopyMessageHeaders();
DECLARE msgBitStream BLOB;
Set msgBitStream =THE ( SELECT ITEM M.MSG_BACKUP FROM Database.tmp.trademanager.MESSAGE as M);
SET OutputRoot.BLOB.BLOB = msgBitStream;
RETURN TRUE;
btw. can I see with the db2-database toll if a BLOB attribute has a value?
Does anyone know what I do wrong? |
|
Back to top |
|
 |
m.schneider |
Posted: Thu Jul 19, 2007 7:09 am Post subject: |
|
|
Centurion
Joined: 10 Apr 2007 Posts: 132 Location: Germany
|
InputRoot.BLOB.BLOB is already a BLOB, but if I try the following ... same results
INSERT INTO Database.tmp.MESSAGE(MSG_BACKUP)
VALUES ( InputRoot.BLOB.BLOB); |
|
Back to top |
|
 |
dilse |
Posted: Thu Jul 19, 2007 7:45 am Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Do you see any data in tmp.MESSAGE table?
Did you check the value of InputRoot.BLOB.BLOB in debug?
Quote: |
DECLARE msgBitStream BLOB InputRoot.BLOB.BLOB; |
Did you check the value of msgBitStream after the above statement?
If you see data in InputRoot.BLOB.BLOB and not seeing when initialized to msgBitStream then try the following statement instead of above statement to see if it works.
Quote: |
DECLARE msgBitStream BLOB CAST(InputRoot.BLOB.BLOB as BLOB); |
Also check the length of the input BLOB you are getting as you declared the size in table as 2K.
Good luck... |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jul 19, 2007 9:23 pm Post subject: One Way to do this |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Is to declare your table (using DB2 as an example) colums for the things like Properties, MQMD, MQRFH2 & Data as BLOBs.
I have done this and it does work with a little effort on the restore side.
Convert each folder into a blob then you can be fairly sure that you can restore it correctly later on.
You will probably need a few non blob colums as well to help you on the retrieval side. For example, a flag to say that you have an MQRFH2 Header.
Date/Time is also a goo one and is some bit of parsed data from the message itself. _________________ 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 |
|
 |
m.schneider |
Posted: Thu Jul 19, 2007 11:21 pm Post subject: |
|
|
Centurion
Joined: 10 Apr 2007 Posts: 132 Location: Germany
|
Thanks for your input
It's running, ...
DB2 shows something like COM.ibm.db2.jdbc.app.DB2Blob@32f14ec1 in the BLOB attribute.
DECLARE inCCSID INT InputRoot.Properties.CodedCharSetId;
DECLARE inEncoding INT InputRoot.Properties.Encoding;
DECLARE inMsgSet CHARACTER InputRoot.Properties.MessageSet;
DECLARE inMsgType CHARACTER InputRoot.Properties.MessageType;
DECLARE inMsgFormat CHARACTER InputRoot.Properties.MessageFormat;
DECLARE msgBitStream BLOB ASBITSTREAM(InputRoot.MRM ,inEncoding, inCCSID, inMsgSet, inMsgType, inMsgFormat);
INSERT INTO Database.tmp.MESSAGE(MSG_BACKUP)
VALUES ( msgBitStream);
I just save the data of the message |
|
Back to top |
|
 |
|