Importing data with the CLI LOAD utility in CLI applications
The CLI
LOAD functionality provides an interface to the IBM®
Db2®
LOAD utility from CLI.
This
functionality allows you to insert data in CLI using
LOAD instead of array insert. This option can yield significant performance
benefits when large amounts of data need to be inserted. Because this interface invokes
LOAD, the same consideration given for using LOAD should also
be taken into account when using the CLI
LOAD interface.
Before you begin
Note: The CLI
LOAD interface to the IBM
Db2
LOAD utility is not supported when accessing an Informix® database
server.
About this task
Note: Starting from Version 9.7, Fix Pack
4, this feature can also be used with the CLI async
processing feature.
- Unlike the IBM Db2 LOAD utility, the CLI LOAD utility does not load data directly from an input file. Instead, if required, the application should retrieve the data from the input file and insert it into the appropriate application parameters that correspond to the parameter markers in the prepared statement.
- If the prepared SQL statement for inserting data contains a SELECT clause, parameter markers are not supported.
- The prepared SQL statement for inserting data must include parameter markers for all columns in the target table, unless a fullselect is used instead of the VALUES clause in the INSERT statement.
- The insertion of data is non-atomic because the load utility precludes atomicity. LOAD might not be able to successfully insert all the rows passed to it. For example, if a unique key constraint is violated by a row being inserted, LOAD will not insert this row but will continue loading the remaining rows.
- A COMMIT will be issued by LOAD. Therefore, if the insertion of the data completes successfully, the LOAD and any other statements within the transaction cannot be rolled back.
- The error reporting for the CLI LOAD interface differs from that of array insert. Non-severe errors or warnings, such as errors with specific rows, will only appear in the LOAD message file.
Procedure
To import data using the CLI LOAD utility: