Author |
Message
|
Rockon |
Posted: Tue Sep 07, 2004 11:38 am Post subject: Insert an XML file into a DB field |
|
|
Apprentice
Joined: 24 May 2004 Posts: 43
|
Hello all,
Isit possible to insert an XML file into a DB2 table field of type "CLOB"?
My requirements are :
Pick up an well-formed XML file(irrespective of the contents) from a Queue and put it into a single DB2 table field of type "CLOB".
I am using DB2v8.1 and WMQI2.1 CSD05
I appreciate if anyone can share their thoughts or approach towards acheiving this.
Thankyou,
Cheers |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Sep 07, 2004 11:49 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Yes, it's possible.
Do a search here for the word 'asbitstream'. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kirani |
Posted: Tue Sep 07, 2004 10:43 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Rockon wrote: |
Pick up an well-formed XML file(irrespective of the contents) from a Queue and put it into a single DB2 table field of type "CLOB".
|
Are you talking about Reference messages? _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
neo_revolution |
Posted: Wed Sep 08, 2004 12:23 pm Post subject: |
|
|
Voyager
Joined: 21 Oct 2003 Posts: 80 Location: NJ
|
I did this way
DECLARE msgBlob BLOB;
SET msgBlob = ASBITSTREAM(InputRoot.XML.logDta OPTIONS FolderBitStream);
and insert it into the BLOB field. 'CLOB' shoulb the same way.
Thanks |
|
Back to top |
|
 |
kirani |
Posted: Wed Sep 08, 2004 10:17 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
You can use CCSID parameter to make it String when inserting into CLOB fields. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
neo_revolution |
Posted: Thu Sep 09, 2004 4:15 am Post subject: |
|
|
Voyager
Joined: 21 Oct 2003 Posts: 80 Location: NJ
|
Just a note regarding InputRoot.XML.logDta, this is a sub-xml tree, which is Rockon's requirement.
Thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 09, 2004 5:49 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
neo_revolution wrote: |
Just a note regarding InputRoot.XML.logDta, this is a sub-xml tree, which is Rockon's requirement. |
Then it sure would have been nice if he'd been more specific.
Not that it would have changed my answer...
ASBITSTREAM is the function to use, it collapses an entire tree (rooted anywhere in the available trees) into a stream of bits. This can then be treated as character data, if cast appropriately, or treated as binary data. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Rockon |
Posted: Thu Sep 09, 2004 1:53 pm Post subject: |
|
|
Apprentice
Joined: 24 May 2004 Posts: 43
|
Thankyou for all your responses,
I used ASBITSTREAM function.It took some time to figure out ,but it worked like a charm
Cheers |
|
Back to top |
|
 |
|