
The following are instructions on how to execute the Export or Import of data with Loader CLI in command mode.
You require the demo databases DEMODB and TESTDB. Start the Loader in command file mode: loadercli -b <command.dat>. The command_file contains the Loader commands necessary for the planned transformation.
You can then modify the generated command file and execute it in Loader command file mode. See also: Loader, Command file Mode, Command File,Transformation
Calling the Loader CLI in command file mode
loadercli -b command.dat -d demodb -u mona,red -n genua -E 20
The Loader establishes a connection to the database DEMODB on computer GENUA for the database user MONA. The Loader processes the commands and statements contained in the command file command.dat. If errors occur (return code <> 0), processing of the command file is terminated as soon as 20 commands have terminated with an error.
The command file command.dat may have the following content:
//IMPORT TABLE DATA
IMPORT TABLE hotel.customer
CATALOG INSTREAM 'customer_ddl.catalog'
DATA INSTREAM 'customer_csv.data'
PAGE WITH 25 ROWS USAGE
//CREATE INDEX
CREATE INDEX customer_index ON hotel.customer(name ASC,firstname ASC)
//EXPORT COLUMNS
EXPORT COLUMNS cno, title, name, firstname
FROM hotel.customer WITH LOCK
DATA OUTSTREAM 'newcustomer_csv.data'
This command file contains the following Loader commands and SQL statements: IMPORT TABLE, CREATE INDEX and EXPORT COLUMNS. You have to specify the information on the database session (database user, name of database, name of database computer) as a command line option when you call the Loader.
Calling the Loader CLI in Command File Mode with an Explicitly Specified Command Separator
loadercli -b command.dat -d demodb -u mona,red -n genua -E 20 -cs ;
The Loader establishes a connection to the database DEMODB on computer GENUA for the user MONA. The Loader processes the commands and statements contained in the command.dat command file. If errors occur (return code <> 0), processing of the command file is terminated as soon as 20 commands have terminated with an error.
The command file command.dat may have the following content:
//IMPORT TABLE DATA
IMPORT TABLE hotel.customer
CATALOG INSTREAM 'customer_ddl.catalog'
DATA INSTREAM 'customer_csv.data'
PAGE WITH 25 ROWS USAGE;
//CREATE INDEX
CREATE INDEX customer_index ON hotel.customer(name ASC,firstname ASC);
//EXPORT COLUMNS
EXPORT COLUMNS cno, title, name, firstname
FROM hotel.customer WITH LOCK
DATA OUTSTREAM 'newcustomer_csv.data';
This command file contains the following Loader commands and SQL statements: IMPORT TABLE, CREATE INDEX and EXPORT COLUMNS, all of which require a subsequent semi-colon. You have to specify the information on the database session (database user, name of database, name of database computer) as a command line option when you call the Loader.
Loader, Loader Log File