Re: Bilder(z.B. *.bmp) in LOB-TABLES speichern


[ Antworten ] [ Forum ]

Geschrieben von Gernot Ruban on Dezember 05, 2000 um 22:49:

Als Antwort auf Bilder(z.B. *.bmp) in LOB-TABLES speichern geschrieben von michael beermann on November 30, 2000 um 10:14:

Hallo Michael,

das ist eine lange Geschichte und wie immer gibt es mehrere Möglichkeiten.

Eine davon sind die DB2 Extender! Bitte verschaffe Dir selbst anhand des IBM Buchs DB2 Universal Database for OS/390, Image, Audio, and Video Extenders
Administration and Programming, Version 6, SC26-9650-00, einen Überblick.

Bücher gibt's im Internet bei IBM, oder auf CD als Softcopy. Ich kann gerne bei der Bestellung behilflich sein, sollte aber kein Problem sein.

Es gibt ein paar Vorbereitungsschritte, um z.B. den Server und die Zielobjekte vorzubereiten. Am Ende kommt man dann beispielsweise zu folgendem Statement:
EXEC SQL UPDATE EMPLOYEE
SET PICTURE=CONTENT(
PICTURE,
'/employee/newimg/ajones.bmp',
'BMP', /*source format*/
'GIF', /*target format*/
'')
WHERE NAME='Anita Jones';

Ansonsten bleibt DB2 Universal Database for OS/390, Application Programming and SQL Guide Version 6, SC26-9004-01:

4.2.2 Declaring LOB host variables and LOB locators
Declarations of LOB host variables in PL/I: Table 28 shows PL/I declarations for some typical LOB types.

+----------------------------------------------------------------------------------------+
¦ Table 28. Examples of PL/I variable declarations ¦
+----------------------------------------------------------------------------------------¦
¦ You Declare this Variable ¦ DB2 Generates this Variable ¦
+-------------------------------------+--------------------------------------------------¦
¦ DCL BLOB_VAR ¦ DCL 1 BLOB_VAR, ¦
¦ SQL TYPE IS BLOB (1M); ¦ 2 BLOB_VAR_LENGTH FIXED BINARY(31), ¦
¦ ¦ 2 BLOB_VAR_DATA,(1) ¦
¦ ¦ 3 BLOB_VAR_DATA1(32) ¦
¦ ¦ CHARACTER(32767), ¦
¦ ¦ 3 BLOB_VAR_DATA2 ¦
¦ ¦ CHARACTER(1048576-32*32767); ¦
+-------------------------------------+--------------------------------------------------¦
¦ DCL CLOB_VAR ¦ DCL 1 CLOB_VAR, ¦
¦ SQL TYPE IS CLOB (40000K); ¦ 2 CLOB_VAR_LENGTH FIXED BINARY(31), ¦
¦ ¦ 2 CLOB_VAR_DATA,(1) ¦
¦ ¦ 3 CLOB_VAR_DATA1(1250) ¦
¦ ¦ CHARACTER(32767), ¦
¦ ¦ 3 CLOB_VAR_DATA2 ¦
¦ ¦ CHARACTER(40960000-1250*32767); ¦
+-------------------------------------+--------------------------------------------------¦
¦ DCL DBCLOB_VAR ¦ DCL 1 DBCLOB_VAR, ¦
¦ SQL TYPE IS DBCLOB (4000K); ¦ 2 DBCLOB_VAR_LENGTH FIXED BINARY(31), ¦
¦ ¦ 2 DBCLOB_VAR_DATA,(2) ¦
¦ ¦ 3 DBCLOB_VAR_DATA1(2500) ¦
¦ ¦ GRAPHIC(16383), ¦
¦ ¦ 3 DBCLOB_VAR_DATA2 ¦
¦ ¦ GRAPHIC(40960000-2500*16383); ¦
+-------------------------------------+--------------------------------------------------¦
¦ DCL blob_loc ¦ DCL blob_loc FIXED BINARY(31); ¦
¦ SQL TYPE IS BLOB_LOCATOR; ¦ ¦
+-------------------------------------+--------------------------------------------------¦
¦ DCL clob_loc ¦ DCL clob_loc FIXED BINARY(31); ¦
¦ SQL TYPE IS CLOB_LOCATOR; ¦ ¦
+-------------------------------------+--------------------------------------------------¦
¦ DCL dbclob_loc ¦ DCL dbclob_loc FIXED BINARY(31); ¦
¦ SQL TYPE IS DBCLOB_LOCATOR; ¦ ¦
+----------------------------------------------------------------------------------------+

Notes to Table 28:

1. Because the PL/I language allows character declarations of no more than 32767 bytes, for BLOB or CLOB host variables that are greater than
32767 bytes in length, DB2 creates host language declarations in the following way:

 If the length of the LOB is greater than 32767 bytes and evenly divisible by 32767, DB2 creates an array of 32767-byte strings. The
dimension of the array is length/32767.

 If the length of the LOB is greater than 32767 bytes but not evenly divisible by 32767, DB2 creates two declarations: The first is an array of
32767 byte strings, where the dimension of the array, n, is length/32767. The second is a character string of length length-n*32767.


2. Because the PL/I language allows graphic declarations of no more than 16383 double-byte characters, DB2 creates host language declarations
in the following way:

 If the length of the LOB is greater than 16383 characters and evenly divisible by 16383, DB2 creates an array of 16383-character strings.
The dimension of the array is length/16383.

 If the length of the LOB is greater than 16383 characters but not evenly divisible by 16383, DB2 creates two declarations: The first is an
array of 16383 byte strings, where the dimension of the array, m, is length/16383. The second is a character string of length
length-m*16383.

Ich hoffe, das hilft erstmal weiter.

Gruß
Gernot





Antworten:


Schreibe eine Antwort

Name:   
E-Mail:  

Thema:

Kommentar:

Optionale Link URL:   
Link Titel:                  
Optionale Image URL:


[ Antworten ] [ Forum ]