Loading the simple-large-object images with the blobload utility
The blobload utility is the IBM® Informix® ESQL/C program that is provided as part of the Informix ESQL/C demonstration files. It uses a command-line syntax to load a byte image into a specified table and column of a database.
To load the simple-large-object images with blobload:
- Compile the blobload.ec program with the
following command:
esql -o blobload blobload.ec
- Enter blobload on the UNIX command line without any arguments.The following figure shows the output of this command that describes the command-line arguments that blobload expects.Figure 1. Sample output from the blobload utility
Sorry, you left out a required parameter. Usage: blobload {-i | -u} -- choose insert or update -f filename -- file containing the blob data -d database_name -- database to open -t table_name -- table to modify -b blob_column -- name of target column -k key_column key_value -- name of key column and a value -v -- verbose documentary output All parameters except -v are required. Parameters may be given in any order. As many as 8 -k parameter pairs may be specified.
- Run the blobload program to load each image
to its proper cat_picture column.
The -u option of blobload updates a specified column with a simple-large-object image. To identify which column to update, you must also use the -f, -d, -t, -b, and -k options of blobload.
You must run the blobload program once
for each image file that you want to update. For example, the following
command loads the contents of the cn_10027.gif file into the cat_picture column
of the row for catalog_num 10027. The catalog_num column
is the key column in the catalog table.
blobload -u -f cn_10027.gif -d stores7 -t catalog -b cat_picture -k
catalog_num 10027
Use the same command to update each of the four remaining image files, substituting the file name (-f option) and corresponding catalog_num value (-k option) of the image file that you want to load.