I have an issue I've been working on that has proven to be quite
troublesome. I already have an idea of what the anwser may be, but
would like to solicit some suggestions or other ideas from you guys
(and gals I'm sure).
We have an application that will store BLOB data (jpegs) along with
character data. The data comes to us in an xml format.; and this xml
document contains both the character and the blob/binary data. Here is
the table DDL:
CREATE TABLE "AIMD"."AIMRETR IEVEDITEM" (
"AIMRETRIEVEDIT EMID" DECIMAL(13,0) NOT NULL GENERATED ALWAYS AS
IDENTITY ( START WITH +1 , INCREMENT BY +1 , CACHE 20 ) ,
"AIMRETRIEVALID " DECIMAL(13,0) NOT NULL ,
"ARCHIVEDOCUMEN TID" VARCHAR(36) ,
"AIMDOCUMEN TID" VARCHAR(256) ,
"CAPTUREDAT E" TIMESTAMP ,
"ACCOUNTNUM BER" VARCHAR(24) ,
"ROUTINGTRANSIT NUMBER" VARCHAR(9) ,
"IMAGETYPE" VARCHAR(5) ,
"STATUS" VARCHAR(256) NOT NULL ,
"IMAGESIZE" INTEGER ,
"SEQUENCENUMBER " INTEGER ,
"LOCATION" VARCHAR(24) ,
"SERVER" VARCHAR(24) ,
"FOLDER" VARCHAR(24) ,
"RESULTERRORSEV ERITY" INTEGER ,
"RESULTERRORTYP E" VARCHAR(256) ,
"RESULTERRORMES SAGE" VARCHAR(256) ,
"IMAGEERRORSEVE RITY" INTEGER ,
"IMAGEERRORTYPE " VARCHAR(256) ,
"IMAGEERRORMESS AGE" VARCHAR(256) ,
"CACHEDIMAG E" BLOB(65536) NOT LOGGED COMPACT ,
"ITEMVIEWCO UNT" INTEGER )
IN "USERSPACE1 " ;
I know that I will have to use IMPORT in order to get the binary data
into the database. The first of my questions is this: since IMPORT is
strictly a CLP command, is there any way within DB2 to invoke a CLP
session behind the scenes from within a stored procedure and then send
CLP commands to that session?
The second issue has to do with the xml itself. Let's say for
simplicity sake that CLP is not an issue. Is there a file type within
the IMPORT command that would cover an input file type of xml? Or
would we need to convert that file to some other type (ixf, csv,
etc.), create a separate file for the binary data, and then import the
two files separately?
Here's a sample of the XML:
15Oct03 10:07:50:884 Reply XML: <?xml version="1.0"
encoding="UTF-8" standalone="yes "?>
<imageReply>
<status>success </status>
<resultCount> 1</resultCount>
<errorOutput>
<errSeverity> </errSeverity>
<errType></errType>
<errMsg></errMsg>
</errorOutput>
<imageOutput>
<locationName>V P07T</locationName>
<serverName>VP0 7T</serverName>
<folderName>USB CMBINQ</folderName>
<imageList>
<imageDetail>
<imageErr>
<imageErrSeveri ty>null</imageErrSeverit y>
<imageErrType>n ull</imageErrType>
<imageErrMsg>nu ll</imageErrMsg>
</imageErr>
<docId>5013-5015-5017-DAA1-12FAAA-0-27413-1</docId>
<docLocation>Un known</docLocation>
<imageType>AF P</imageType>
<imageStatus>tr ue</imageStatus>
<imageSize>2741 3</imageSize>
<image></image>
<imageFront> THIS IS WHERE THE BINARY DATA IS
</imageFront>
<imageFrontSize >7507</imageFrontSize>
<imageFrontType >TIF</imageFrontType>
Any help or suggestions would be greatly appreciated.
Thanks in advance.
troublesome. I already have an idea of what the anwser may be, but
would like to solicit some suggestions or other ideas from you guys
(and gals I'm sure).
We have an application that will store BLOB data (jpegs) along with
character data. The data comes to us in an xml format.; and this xml
document contains both the character and the blob/binary data. Here is
the table DDL:
CREATE TABLE "AIMD"."AIMRETR IEVEDITEM" (
"AIMRETRIEVEDIT EMID" DECIMAL(13,0) NOT NULL GENERATED ALWAYS AS
IDENTITY ( START WITH +1 , INCREMENT BY +1 , CACHE 20 ) ,
"AIMRETRIEVALID " DECIMAL(13,0) NOT NULL ,
"ARCHIVEDOCUMEN TID" VARCHAR(36) ,
"AIMDOCUMEN TID" VARCHAR(256) ,
"CAPTUREDAT E" TIMESTAMP ,
"ACCOUNTNUM BER" VARCHAR(24) ,
"ROUTINGTRANSIT NUMBER" VARCHAR(9) ,
"IMAGETYPE" VARCHAR(5) ,
"STATUS" VARCHAR(256) NOT NULL ,
"IMAGESIZE" INTEGER ,
"SEQUENCENUMBER " INTEGER ,
"LOCATION" VARCHAR(24) ,
"SERVER" VARCHAR(24) ,
"FOLDER" VARCHAR(24) ,
"RESULTERRORSEV ERITY" INTEGER ,
"RESULTERRORTYP E" VARCHAR(256) ,
"RESULTERRORMES SAGE" VARCHAR(256) ,
"IMAGEERRORSEVE RITY" INTEGER ,
"IMAGEERRORTYPE " VARCHAR(256) ,
"IMAGEERRORMESS AGE" VARCHAR(256) ,
"CACHEDIMAG E" BLOB(65536) NOT LOGGED COMPACT ,
"ITEMVIEWCO UNT" INTEGER )
IN "USERSPACE1 " ;
I know that I will have to use IMPORT in order to get the binary data
into the database. The first of my questions is this: since IMPORT is
strictly a CLP command, is there any way within DB2 to invoke a CLP
session behind the scenes from within a stored procedure and then send
CLP commands to that session?
The second issue has to do with the xml itself. Let's say for
simplicity sake that CLP is not an issue. Is there a file type within
the IMPORT command that would cover an input file type of xml? Or
would we need to convert that file to some other type (ixf, csv,
etc.), create a separate file for the binary data, and then import the
two files separately?
Here's a sample of the XML:
15Oct03 10:07:50:884 Reply XML: <?xml version="1.0"
encoding="UTF-8" standalone="yes "?>
<imageReply>
<status>success </status>
<resultCount> 1</resultCount>
<errorOutput>
<errSeverity> </errSeverity>
<errType></errType>
<errMsg></errMsg>
</errorOutput>
<imageOutput>
<locationName>V P07T</locationName>
<serverName>VP0 7T</serverName>
<folderName>USB CMBINQ</folderName>
<imageList>
<imageDetail>
<imageErr>
<imageErrSeveri ty>null</imageErrSeverit y>
<imageErrType>n ull</imageErrType>
<imageErrMsg>nu ll</imageErrMsg>
</imageErr>
<docId>5013-5015-5017-DAA1-12FAAA-0-27413-1</docId>
<docLocation>Un known</docLocation>
<imageType>AF P</imageType>
<imageStatus>tr ue</imageStatus>
<imageSize>2741 3</imageSize>
<image></image>
<imageFront> THIS IS WHERE THE BINARY DATA IS
</imageFront>
<imageFrontSize >7507</imageFrontSize>
<imageFrontType >TIF</imageFrontType>
Any help or suggestions would be greatly appreciated.
Thanks in advance.
Comment