DB2 Version 9.7 for Linux, UNIX, and Windows

Importing data

The import utility inserts data from an external file with a supported file format into a table, hierarchy, view, or nickname. The load utility is a faster alternative, but the load utility does not support loading data at the hierarchy level.

About this task

The following restrictions apply to the import utility:

The following limitation applies to the import utility: If the volume of output messages generated by an import operation against a remote database exceeds 60 KB, the utility will keep the first 30 KB and the last 30 KB.

Before you begin

Before invoking the import utility, you must be connected to (or be able to implicitly connect to) the database into which you want to import the data. If implicit connect is enabled, a connection to the default database is established. Utility access to DB2® for Linux, UNIX, or Windows database servers from DB2 for Linux, UNIX, or Windows clients must be a direct connection through the engine. Utility access cannot be through a DB2 Connect™ gateway or loop back environment. Since the utility issues a COMMIT or a ROLLBACK statement, complete all transactions and release all locks by issuing a COMMIT statement or a ROLLBACK operation before invoking import.

Note: The CREATE and REPLACE_CREATE parameters of the IMPORT command are deprecated and might be removed in a future release.

Procedure

To run the import utility:

Example

A very simple import operation requires you to specify only an input file, a file format, an import mode, and a target table (or the name of the table that is to be created).

For example, to import data from the CLP, enter the IMPORT command:
db2 import from filename of fileformat import_mode into table	
where filename is the name of the input file that contains the data you want to import, fileformat is the file format, import_mode is the mode, and table is the name of the table that you want to insert the data into.
However, you might also want to specify a messages file to which warning and error messages are written. To do that, add the MESSAGES parameter and a message file name. For example:
db2 import from filename of fileformat messages messagefile import_mode into table	

For complete syntax and usage information, see "IMPORT command."