IBM Books

Image, Audio, and Video Extenders Administration and Programming

Storing an object that resides on the server

When the image, audio, or video you want to store is in a server file, specify its path as the content argument to the UDF. For example, the following statement in a C application program stores a row that includes an image into the database. The image content is in a file on the server. The stored image remains in the server file and is pointed to from the database.

EXEC SQL BEGIN DECLARE SECTION;
  long hvStorageType;
EXEC SQL END DECLARE SECTION;
 
hvStorageType=MMDB_STORAGE_TYPE_EXTERNAL;
 
EXEC SQL INSERT INTO EMPLOYEE VALUES(
        '128557',
        'Anita Jones',
        DB2IMAGE(
          CURRENT SERVER,
          '/employee/images/ajones.bmp', /*source in server file */
          'BMP',
          :hvStorageType,
          'Anita''s picture')
       );

Specify the correct path: When you store an object whose source is in a server file, you can specify the file's fully qualified name or a relative name. If you specify a relative name, you need to ensure that the appropriate environment variables in the DB2 server include the correct path for the file. For information about setting these environment variables, see Appendix A, Setting environment variables for DB2 extenders.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]