From version 9, Mimer SQL provides extremely flexible methods for loading information to and from databases using the LOAD and UNLOAD commands and the MIMLOAD program.
This article will give a short introduction to the functionality.
LOAD and UNLOAD can be used with Mimer SQL from any ODBC-based SQL command interpreter, or from the standalone MIMLOAD program.
Using the LOAD command, you can:
- load information from one or more files into a Mimer SQL database
- optimize loading for best performance
- select exactly the information you want and place it precisely where you want it, using an SQL statement
- log the load operation
Using the UNLOAD command, you can:
- customize the information
- unload whole databanks or select specific information using an SQL statement
- log the unload operation
Using the MIMLOAD program, you can use LOAD and UNLOAD directly from your operating system command prompt. Using the STDIN, STDOUT and STDERR options in the LOAD/UNLOAD syntax, you can enable command line file redirection for input, output and logging.
The LOAD functionality
The LOAD command copies definitions and/or data from one or more files. When loading information from more than one file, the files are read in the order defined. The input file(s) are expected to form a valid sequence of definitions, data descriptions and data.
Triggers defined against the affected tables are applied when the data is loaded.
LOAD’s default behavior implies that you have exclusive access to the databank being loaded with data. If you need shared access, you can use the WITH SHARED ACCESS option. In most cases, this will lead to a slower data load using row-wise insert.
As mentioned, LOAD uses the fast data load facility in most cases, but there are some situations that need row-wise insertion due to certain referential constraints. In such cases, a warning message will tell you that fast data load cannot be used and the operation will continue using rowwise insertions.
When row-wise insertions are performed, loads are recorded in LOGDB (assuming the databank is defined with the LOG option).
The UNLOAD functionality
The UNLOAD command generates data and/or definitions and places the result in a single file. You can use the options ALL (default), DEFINITIONS or DATA to specify the information you want.
When generating the data and definitions, a data description header is created before information is written to the file. If information from several tables is generated, a data description header for each data section is created.
A data description header contains escaping information and column separator information.
For details on LOAD, UNLOAD and MIMLOAD, please refer to the Mimer SQL Documentation set. Look for the section Loading and Unloading Data and Definitions in the System Management Handbook part.