In this section:
Images and other binary files can be loaded into BLOB (Binary Large Object) fields in supported relational databases.
DataMigrator has the capability to load image files into a database table by specifying their location in the input data.
The first step is to create a table to store the images. The table to load should have a column with a data type that can hold binary data. In the current release of MS SQL Server, that would be varbinary(max). In previous releases, it is image. In the synonym, the USAGE and ACTUAL fields for the column are set to BLOB (Binary Large OBject), as shown in the following image.
The following example outlines the remaining steps needed to load images into a database table.
The first step is to map an application directory. The location of the files containing the images is specified in the usual appdir/filename format. To map the application directory:
The Create New Application dialog box opens.
The Create New Application dialog box should look like the following image.
Next, create a source file and synonym. The source data needs a list of the names of the image files. From the DMC:
The following image shows the result.
Then, create a synonym for the file.
Next, create a data flow that loads the images into a database table. The source is the delimited flat file tiles that contains the names of the image files. The target is the existing database table textures.
The Transformations window opens, as shown in the following image.
Wait for the completed message to appear in the console log and then click View Last Log to verify that the three rows were loaded.
To see the images that were loaded into the table, you need to write a FOCUS report that sends its output to a PDF file.
TABLE FILE textures PRINT PICTURE BY FNAME ON TABLE PCHOLD AS basapp/texturpt FORMAT PDF ON TABLE SET STYLE * TYPE=REPORT,$ TYPE=DATA,COLUMN=PICTURE,IMAGE=(PICTURE),SIZE=(1 1),POSITION=(+0.5 +0.5),$ END
The PDF file will open in the workspace.