OdiSqlUnload

Usage

OdiSqlUnload -FILE=<file_name> -DRIVER=<driver> -URL=<url> -USER=<user> -PASS=<password> [-FILE_FORMAT=<file_format>] [-FIELD_SEP=<field_sep> | -XFIELD_SEP=<field_sep>] [-ROW_SEP=<row_sep> | -XROW_SEP=<row_sep>] [-DATE_FORMAT=<date_format>] [-ABS=<yes|no>] [-CHARSET_ENCODING=<encoding>] [-XML_CHARSET_ENCODING=<encoding>]  [-FETCH_SIZE=<array_fetch_size>] [CR/LF <sql_query> | -QUERY=<sql_query> | -QUERY_FILE=<sql_query_file> ]

Description

Generates a data file by executing the SQL query <sql_query> on the data server whose connection parameters are provided by <driver>, <url>, <user> and <encoded_pass>. The file is written to the path defined by <file_name> (relative to the agent).

Parameters

Parameters

Mandatory

Description

-FILE=<file_name>

Yes

Full path to the output file, relative to the execution agent.

-DRIVER=<driver>

Yes

Name of the JDBC driver used to connect to the data server.

-CHARSET_ENCODING=<encoding>

No

Target file encoding. Default value is ISO8859-1. There is a full list of supported encodings at the following URL: http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html

-XML_CHARSET_ENCODING=<encoding>

No

Encoding specified in the XML File, in the tag  <?xml version="1.0" encoding="ISO-8859-1"?>. Default value is ISO8859-1. There is a list of supported encodings at the following URL: http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html

-URL=<url>

Yes

JDBC URL to the data server.

-USER=<user>

Yes

Login of the user on the data server which will be used to run the SQL query.

-PASS=<password>

Yes

Encrypted password for the login to the data server. This password can be encrypted with the system command:

agent(.bat or .sh) encode <clear_text_password>.

Note: agent(.bat or .sh) is located in the /bin sub-directory of your Oracle Data Integrator installation directory.

-FILE_FORMAT=<file_format>

No

Specifies the file format with one of the following three values:

  • fixed : fixed size recording,

  • variable : variable size recording,

  • xml : XML file.

If <file_format> is not specified, the format defaults to variable.

If <file_format> is xml, the XML nodes generated have the following structure:

<TABLE>

   <ROW>

      <column_name>![CDATA[VALUE]]</column_name>

      <column_name>![CDATA[VALUE]]</column_name>

      ...

   </ROW>

   ....

</TABLE> 

-FIELD_SEP=<field_sep>

No

Field separator character in ASCII format if FILE_FORMAT=variable. The default <field_sep> is a tab character.

-XFIELD_SEP=<field_sep>

No

Field separator character in hexadecimal format if FILE_FORMAT=variable. The default <field_sep> is a tab character.

-ROW_SEP=<row_sep>

No

Record separator character in ASCII format. Default <row_sep> is a Windows carriage return. For instance, the following values can be used:

  • Unix: -ROW_SEP=\n

  • Windows: -ROW_SEP=\r\n

-XROW_SEP=<row_sep>

No

Record separator character in hexadecimal format. Example: 0A.

-DATE_FORMAT=<date_format>

No

Output format used for date datatypes. For more information see Date Format.

-ABS=<yes|no>

No

If set to yes in a fixed file format, only the absolute values of numeric values.  That is, the sign of the number is not output. Otherwise, the sign is added before the numeric value, and the field's physical length will be equal to its logical length +1.

-FETCH_SIZE=<array_fetch_size>

No

The number of rows (records read) requested by Data Integrator in each communication with the data server.

CR/LF <sql_query> or -QUERY=<sql_query> or -QUERY_FILE=<sql_query_file>

Yes

SQL query to execute on the data server. The query must be a SELECT statement or a call to a stored procedure returning a valid recordset.  This query can be entered on the line following the OdiSqlUnload command (A carriage return - CR/LF -  indicates the beginning of the query). The query can be defined with the -QUERY parameter, or stored in a file specified with the -QUERY_FILE parameter . The -QUERY or -QUERY_FILE parameters should be used when calling this command from an OS command line.

Note: The old syntax using REQUEST and REQUEST_FILE is still valid but deprecated

Examples

The command 

OdiSqlUnload -FILE=C:\temp\clients.csv -DRIVER=sun.jdbc.odbc.JdbcOdbcDriver -URL=jdbc:odbc:NORTHWIND_ODBC -USER=sa -PASS=NFNEKKNGGJHAHBHDHEHJDBGBGFDGGH -FIELD_SEP=; "-DATE_FORMAT=dd/MM/yyyy hh:mm:ss"

select cust_id, cust_name, cust_creation_date
from Northwind.dbo.Customers

generates the file C:\temp\clients.csv separated by ';', containing the result of the query on the Customers table.