dbload command examples
These examples show how to specify dbload parameters and sample ways of using the dbload command.
The following examples illustrate how to specify parameters for the dbload command:
- The table repeat_cust is delimited by using the vertical bar character (|) and
is in the input file clickstream.dat. To load this table, enter the following
command:
dbload -t repeat_cust -delim '|' -df clickstream.datThis example does not specify the -u, -pw, or -db options, so defaults are used. These options are described in dbload command options.
- The admin user has the password production. The table areacode in the database
dev is delimited by tabs and is in the input file phone-prefix.dat. To load
this table, enter the following
command:
dbload -u admin -pw production -db dev -t areacode -delim '\t' -df phone-prefix.dat - The following command specifies the name of a load file:
dbload -u admin -pw password -host targetHost -db emp -t name -df /tmp/daily/Import.bad - The following command utilizes -remoteSource option in order to enforce using
remote load to a database on the localhost. By default when a user specifies -host
localhost a local load is performed. Only by using -remoteSource a remote
load to the localhost can be done.
dbload -u admin -pw password -host localhost -remoteSource YES -db emp -t name -df /tmp/daily/Import.bad - The following command specifies the boolean style:
dbload -u admin -pw password -host targetHost -db emp -t name -df /tmp -boolStyle yes_no - The following command specifies the name of a control file:
dbload -u admin -pw password -host targetHost -db emp -t name -cf /tmp/daily/control.file - The following command allows unescaped carriage returns in char() and
varchar() fields:
dbload -u admin -pw password -host targetHost -db emp -t name -df /tmp -crinString - The following command allows an ASCII value of 1 - 31 in char() and varchar()
fields:
dbload -u admin -pw password -host targetHost -db emp -t name -ctrlChars - The following command specifies the field delimiter:
dbload -u admin -pw password -host targetHost -db emp -t name -delim ',' - The following command specifies the use of an escape character:
dbload -u admin -pw password -host targetHost -db emp -t name -df /tmp -escapeChar '\\' - The following command specifies an input line with fewer columns than that of
the table definition:
dbload -u admin -pw password -host targetHost -db emp -t name -fillRecord - The following command specifies discarding of the byte value zero in the
char() and varchar() fields:
dbload -u admin -pw password -host targetHost -db emp -t name -ignoreZero no - The following command specifies a log file name:
dbload -u admin -pw password -host targetHost -db emp -t name -lf /tmp/daily/import.log - The following command specifies the maximum number of errors:
dbload -u admin -pw password -host targetHost -db emp -t name -maxErrors 100 - The following command specifies to stop processing when the specified number
of records are in the database:
dbload -u admin -pw password -host targetHost -db emp -t name -maxRows 100 - The following command specifies the string to use for the null value:
dbload -u admin -pw password -host targetHost -db emp -t name -nullValue 'none' - The following command specifies the output directory for the log files:
dbload -u admin -pw password -host targetHost -db emp -t name -outputDir /tmp/daily - The following command specifies that quotation marks are mandatory, except for
null values:
dbload -u admin -pw password -host targetHost -db emp -t name -requireQuotes -quotedValue YES - The following command specifies truncating a string and inserting it into the
declared string:
dbload -u admin -pw password -host targetHost -db emp -t name -truncString - The following commands show the use of options that are related to date and time:
- The following command specifies how to interpret the date format:
dbload -u admin -pw password -host targetHost -db emp -t name -dateDelim '/' -dateStyle MDY - The following command specifies the delimiter to use with the
-dateStyle option:
dbload -u admin -pw password -host targetHost -db emp -t name -dateDelim '/' -dateStyle MDY - The following command specifies the delimiter to use for time
formats:
dbload -u admin -pw password -host targetHost -db emp -t name -timeDelim '.' - The following command specifies allowing but rounding non-zero
digits with smaller than microsecond resolution:
dbload -u admin -pw password -host targetHost -db emp -t name -timeRoundNanos - The following command specifies the time style value in the data
file:
dbload -u admin -pw password -host targetHost -db emp -t name -timeStyle 12hour - The following command specifies the first year in the YY format:
dbload -u admin -pw password -host targetHost -y2Base 2000
- The following command specifies how to interpret the date format:
- The following commands merge records in a data file into target
table t1. The data file and target table each contain three columns: col1,
col2, and col3.
- The following command inserts new rows into table t1 and updates
existing rows in table t1. To determine which rows to insert or update, the values of the col1
column in the data file and the col1 column in the table are used as a match
condition.
dbload -t t1 -df /tmp/data.txt -delim '|' -merge INSERTUPDATE -mergeschema "col1 int primary_key,col2 int,col3 int" - The following command inserts new rows into table t1 and updates
existing rows in table t1. To determine which rows to insert or update, the values of the col1
column in the data file and the col1 column in the table are used as a match condition. In addition,
only the records in the data file whose col1 value is greater than 3 are considered.
dbload -t t1 -df /tmp/data.txt -delim '|' -merge INSERTUPDATE -mergeschema "col1 int,col2 int,col3 int" -mergeon "src.col1 > 3 AND src.col1 = t1.col1" - The following command updates existing rows in table t1. To
determine which rows to update, the values of the col1 column in the data file and the col1 column
in the table are used as a match condition. In addition, only the records in the data file whose
col1 value is greater than 3 are considered.
dbload -t t1 -df /tmp/data.txt -delim '|' -merge UPDATE -mergeschema "col1 int,col2 int,col3 int" -mergeon "src.col1 > 3 AND src.col1 = t1.col1" - The following command inserts new rows into table t1. To determine
which rows to insert, the values of the col1 column in the data file and the col1 column in the
table are used as a match condition. In addition, only the records in the data file whose col1 value
is greater than 3 are considered.
dbload -t t1 -df /tmp/data.txt -delim '|' -merge INSERT -mergeschema "col1 int,col2 int,col3 int" -mergeon "src.col1 > 3 AND src.col1 = t1.col1"
- The following command inserts new rows into table t1 and updates
existing rows in table t1. To determine which rows to insert or update, the values of the col1
column in the data file and the col1 column in the table are used as a match
condition.
- The following commands allow the user to load data from the standard input
of the program:
echo '0|0' | dbload -u bluadmin -pw bluadmin -t test_hex -db bludb -delim '|'echo '0,0' > t1.data dbload -u bluadmin -pw bluadmin -t t1 -schema testdb -delim ',' < t1.data