17.3.1 Importing table data in CSV format
This example imports table data under the following conditions:
-
Table data is imported for the first time into table TABLE01.
-
A B-tree index, text index, or range index is defined for TABLE01.
-
There are two input data files (in CSV format).
-
In the input data files, a single quotation mark (') is used as the enclosing character and a comma (,) is used as the delimiter.
-
Field data in the input data file satisfies the following two conditions:
-
The sort order of field data items matches the order in which the columns appear in the table subject to import processing.
-
The number of field data items matches the number of column definitions for the table to be processed.
-
-
The input data might contain logical error data.
-
Any logical error data that is detected is corrected before the data is imported.
This example uses the following procedure to execute the adbimport command.
- Procedure
-
-
Create an input data path file.
-
Create an import option file.
-
Execute the adbimport command.
-
Using examples, the following subsections explain each of these steps.
- Organization of this subsection
(1) Creating an input data path file
This example creates an input data path file and specifies in it the paths of the two input data files.
- Example of an input data path file
-
/mnt/diska/wwwww/imp1.csv /mnt/diskb/xxxxx/imp2.csv
(2) Creating an import option file
This example creates an import option file that specifies import options.
- Example of an import option file
-
set adb_import_errdata_file_name = "/home/adbmanager/imp_file/errdata.csv" ...1 set adb_import_errdata_num = 500 ...2 set adb_import_rthd_num = 2 ...3 set adb_import_sort_buff_size = 2 :
- Explanation:
-
-
Specifies a logical error data file to which logical error data is to be output.
-
Specifies the maximum number of logical error data items that can be output.
-
Specifies other performance-related import options.
-
(3) Executing the adbimport command
adbimport -u ADBUSER01 ...1 -p '#HelloHADB_01' ...2 -k "'" ...3 -s , ...4 -g 10 ...5 -w /home/adbmanager/tmp ...6 -z /home/adbmanager/imp_file/env01.txt ...7 TABLE01 ...8 /home/adbmanager/imp_file/inf01.txt ...9
- Explanation:
-
-
Specifies the authorization identifier of the HADB user who executes the adbimport command.
-
Specifies the password for the authorization identifier that is specified in the -u option.
-
Specifies the enclosing character (single quotation mark) used in the input data files. If the single quotation mark is used as the enclosing character, each single quotation mark must be enclosed in double quotation marks (").
-
Specifies the delimiter (comma) used in the input data files.
-
Specifies that a data import progress message (KFAA80205-I) is to be output after every 10,000 rows.
-
Specifies a directory for storing temporary work files that will be created during data import processing.
-
Specifies the absolute path name of the import option file created in (2) Creating an import option file.
-
Specifies the table that is to be the target of import processing (TABLE01).
-
Specifies the absolute path name of the input data path file created in (1) Creating an input data path file.
-