Odbcwrite: syntax and options

Syntax for the odbcwrite operator is given below. Optional values that you provide are shown in italic typeface. When your value contains a space or a tab character, you must enclose it in single quotes. Exactly one occurrence of the -tablename option is required.


odbcwrite
  -tablename table_name
  -datasourcename data_source_name
  [-username user_name]
  [-password password]
  [-closecommand close_command]
  [-statement statement]
  [-drop]
  [-db_cs icu_code_page]
  [-arraysize n]
  [-transactionLevels read_uncommitted | read_committed | repeatable read | serializable]
  [-mode create | replace | append | truncate]
  [-opencommand open_command]
  [-rowCommitInterval n]
  [-truncate]
  [-truncateLength n]
  [-useNchar]

Table 1. odbcwrite Operator Options and Values
Option Use
-datasourcename -datasourcename data_source_name

Specify the data source to be used for all database connections. This option is required.

-username -username user_name

Specify the user name used to connect to the data source. This option might or might not be required depending on the data source.

-password -password password

Specify the password used to connect to the data source. This option might or might not be required depending on the data source.

-tablename -tablename table_name

Specify the table to write to. The table name might be fully qualified.

-mode -mode append | create | replace | truncate

Specify the write mode as one of these modes:

append: This operator appends new records into an existing table.

create: This operator creates a new table. If a table exists with the same name as the one you want to create, the step that contains the operator terminates with an error. The schema of the new table is determined by the schema of the InfoSphere® DataStage® data set. The table is created with simple default properties. To create a table that is partitioned, indexed, in a non-default table space, or in some other non-standard way, you can use the -createstmt option with your own create table statement.

replace: This operator drops the existing table and creates a new one in its place. The schema of the InfoSphere DataStage data set determines the schema of the new table.

truncate: This operator deletes all records from an existing table before loading new records.

-statement -statement create_statement

Optionally specify the create statement to be used for creating the table when -mode create is specified.

-drop -drop

If this option is set, unmatched fields in the InfoSphere DataStage data set are dropped. An unmatched field is a field for which there is no identically named field in the datasource table.

-truncate -truncate

When this option is set, column names are truncated to the maximum size allowed by the ODBC driver.

-truncateLength -truncateLength n

Specify the length to truncate column names.

-opencommand -opencommand open_command

Optionally specify an SQL statement to be executed before the insert array is processed. The statements are executed only once on the conductor node.

-closecommand -closecommand close_command

Optionally specify an SQL statement to be executed after the insert array is processed. You cannot commit work using this option. The statements are executed only once on the conductor node.

-arraysize -arraysize n

Optionally specify the size of the insert array. The default size is 2000 records.

-rowCommitInterval -rowCommitInterval n

Optionally specify the number of records to be committed before starting a new transaction. This option can only be specified if arraysize = 1. Otherwise rowCommitInterval = arraysize. This is because of the rollback retry logic that occurs when an array execute fails.

-transactionLevels -transactionLevels read_uncommitted | read_committed | repeatable_read | serializable

Optionally specify the transaction level for accessing data. The default transaction level is decided by the database or possibly specified in the data source.

-db_cs -db_cs code_page_name

Optionally specify the ICU code page which represents the database character set in use. The default is ISO-8859-1.

-useNchar -useNchar

Read all nchars/nvarchars from the database.