IBM DB2 Computer Accessories User Manual


 
Chapter 5. Deploying pre-configured databases 235
5.4.2 Using DB2 utilities
Using the DB2 utilities, import, export, and load, to populate the database allows
you to move data from a source database to a target database. Data in the
source database is exported into a set of files. These files are moved to the
target environment and imported or loaded to the target database.
This approach has the advantage of being platform independent. It is possible to
move data between 32-bit and 64-bit systems as well as to move data from a
Windows environment to a UNIX environment and vise versa.
Three data file formats are supported:
IXF file format:
This internal DB2 interchange file format is supported on all DB2 platforms.
We recommend this format and use it in our examples.
Delimited ASCII file format:
The advantage of this format is that it is readable and editable. This file format
is useful if you want to create a set of SQL insert statements for a table.
However, some considerations are required when using this format, such as
code page or character fields containing row separators. We recommend that
you IXF file format instead of DEL when moving data across platforms.
WSF file format:
This format allows Lotus® products to read the files.
Exporting data
The export utility is very flexible and allow us to export exact the data required.
The utility allows you to extract only the specific rows based on a select
statement as well as select a subset of the columns as well. For our purposes,
we export all columns and all rows.
In Example 5-14 we show how to export data from our sample database ITSODB
to a set of IXF files. Note that we specify a message file name for each export. In
case of errors, examine these message files for further information.
Example 5-14 Exporting data from our sample database
export to “dept.ixf" of ixf messages “dept.msg" select * from itso.department;
export to “staff.ixf” of ixf messages “staff.msg” select * from itso.staff;
export to “emp.ixf” of ixf messages “emp.ixf” select * from itso.employee;