Lob Manager

The LOB Manager is part of the Data Manager which enables Clobs and Blobs to be loaded onto the database.

In the data contents file Blob and Clob fields are handled slightly differently to other fields, in that the value element will not contain the literal data but will instead contain a reference to a file containing the data.

The Lob Manager, illustrates how a table with a numeric and blob column can be populated with one record using a binary file from disk.

Figure 1. Blob Data Contents File
<table name = "BlobEntity">
           <column name = "imageID" type = "number"/>
           <column name = "imageData" type = "blob"/>
           <row>
        <attribute name = "imageID">
        <value>1</value>
              </attribute>
           </row>
           <row>
         <attribute name = "binaryData">
         <value>./images/1.jpg</value>
         </attribute>
     </row>
        </table>

Note that to load Blobs, the LOB Manager can only be used on tables for which the primary key fields are known. This is because inserting a LOB involves an SQL insert followed by an SQL update, and the SQL update must be capable of addressing a single record by means of its primary key.

The Lob Manager, illustrates how a table with a numeric and clob column can be populated with one record using a character data file from disk.Here, the clob data file is encoded with UTF-16 format, and this is specified in the attribute element with encoding as UTF-16 for that row, so the clob content gets encoded before it gets inserted.

Figure 2. Clob Data Contents File
<table name = "Entity">
           <column name = "ID" type = "number"/>
           <column name = "content" type = "clob"/>
           <row>
        <attribute name = "ID">
        <value>1</value>
              </attribute>
           </row>
           <row>
         <attribute name = "content" encoding = "UTF-16">
         <value>./clobcontentdir/1.txt</value>
         </attribute>
     </row>
        </table>

The Lob Manager, illustrates how a table with a numeric and clob column can be populated with two records using the character data files from disk.Here, if all the clob data files are encoded in UTF-16 format, then this can be specified at column level, using encoding attribute, so all the rows for clob type uses the same encoding type of that column. To override this for only a single row, the encoding type can be specified as in previous example at attribute element level of that row element.

Figure 3. Clob Data Contents File in encoded format
<table name = "Entity">
           <column name = "ID" type = "number"/>
           <column name = "Data" type = "clob"
                  encoding = "UTF-16"/>
           <row>
        <attribute name = "ID">
        <value>1</value>
              </attribute>
           </row>
           <row>
         <attribute name = "Data">
         <value>./clobcontentdir/4.txt</value>
         </attribute>
     </row>
           <row>
        <attribute name = "ID">
        <value>2</value>
              </attribute>
           </row>
           <row>
         <attribute name = "Data">
         <value>./clobcontentdir/2.txt</value>
         </attribute>
     </row>
        </table>

The LOB manager identifies primary keys by means of the datamanager_config.xml file, so this file must contain a reference to the generated _PrimaryKeys.xml relating to table containing the LOB.