Large test objects generation and loading in DTM Data Generator

All modern databases support supports large objects. The large object is a big field without structure defined in the database schema. For example, image, map, article or media file (audio, video). Also, the field can contain XML or JSON document.

All our software for test data creation supports methods and generators for mentioned objects: binary or text. However, a few user interface capabilities are available in DTM Data Generator only. In the first part of the article, we'll describe these capabilities and the second one dwells with unified options.

The first built-in tool for database populating by large objects is a BLOB Loader. It opens a folder with disk files and inserts content (one file per field) to database. The user has to provide:

  • Column or columns to be populated by external files
  • Folder with the files
  • Unique key for tables without a predefined primary key

The data generator scans the folder and subfolders and loads the content to database rows sequentially. There are no limitations for the type of files. The program can load media information in the binary format as well as XML or JSON documents as text files.

This sample shows how to load "Descriptions" column content from "d:\descriptions" folder:

DTM Data Generator: loading large objects from the disk

The second way is filling out the BLOB or CLOB column by random binary or text data. Of course, it is the simplest way and the Rule Wizard uses it by default. The Rule Wizard analyzes a structure of your database and prepares optimal data generation rules. By default, the program generates random objects with a length between 1 and maximum length stored in the product's settings. But the user is able to change this range suing rule editor.

The last specific generation method that available in DTM Data Generator is loading objects from another table of the same or another database. The user should select "Linked database table" as a data population method in this case. This sample shows how to use "Photo" column of Employees table as a source of large objects.

DTM Data Generator: loading large objects from the database table

All mentioned options (external file, random object, and object from the database) are available in all our data generation utilities: DTM Flat File Generator, DTM Test XML Generator, Data Generator for JSON, etc. Moreover, the user is enabled to access the same facilities to test loading performance in DTM DB Stress tool.

However, in this case, the user have to prepare database engine calls manually. Let's us describe how to do that. The "Custom Generator" option is available in any our tool. The following screenshots show how to use $BLOB engine call with DTM Test XML Generator and DTM Flat File Generator.

DTM Flat File Generator: $BLOB function usage sample

DTM Test XML Generator: $BLOB function usage sample

If you want to know how fast the server or database can load binary data, DTM DB Stress can help. It has built-in test data generator and the user enabled to use the same function call ($BLOB) to fill out the parameter of SQL statement. The benchmarking tool will show you the data loading performance.

The $BLOB function can load content from a directory in the same manner as BLOB Loader in DTM Data generator. However, it can do that in hexadecimal or text format. For hexadecimal output, the user has to add required prefix (like '0x') or suffix (like 'h') manually.

A, a and X pattern items can be used to populate the field with a random content. For example, X{=4096} produces a hexadecimal string with exact 4096 symbols length. The $RString function is more flexible for CLOB creation. It allows users to assign spaces and separators share as well as Unicode blocks.

The last mentioned feature of the DTM Data Generator is linked table. The $Table function call is suitable for the same purpose in other tools. This call generates the same data as the example with Employees table and Photo column above:

$Table(Employees, Photo)

It is important to establish default connection for this function call. It uses the default connection to identify the database, table, and column from parameters. Otherwise, the user can provide data source name, login, and password to define a custom connection. The multiplatform runtime of DTM Data Generator allows using Java database connectivity (JDBC) instead of ODBC in this call.