August 17, 2023

tOracleBulkExec – Docs for ESB 5.x

tOracleBulkExec

tOracleBulkExec_icon32_white.png

tOracleBulkExec properties

The tOracleOutputBulk and tOracleBulkExec components are used together in a two step process. In
the first step, an output file is generated. In the second step, this file is used in
the INSERT operation used to feed a database. These two steps are fused together in the
tOracleOutputBulkExec component, detailed in a
separate section. The advantage of using two separate steps is that the data can be
transformed before it is loaded in the database.

Component family

Databases/Oracle

 

Function

tOracleBulkExec inserts, appends,
replaces or truncate data in an Oracle database.

Purpose

As a dedicated component, it allows gains in performance during
operations performed on data of an Oracle database.

Basic settings

Property type

Either Built-in or Repository.

Since version 5.6, both the Built-In mode and the Repository mode are
available in any of the Talend solutions.

 

 

Built-in: No property data stored
centrally.

 

 

Repository: Select the repository
file in which the properties are stored. The fields that follow are
completed automatically using the data retrieved.

 

Use an existing connection

Select this check box and in the Component List click the
relevant connection component to reuse the connection details you already defined.

Note

When a Job contains the parent Job and the child Job, if you need to share an existing
connection between the two levels, for example, to share the connection created by the
parent Job with the child Job, you have to:

  1. In the parent level, register the database connection to be shared in the
    Basic settings view of the connection
    component which creates that very database connection.

  2. In the child level, use a dedicated connection component to read that
    registered database connection.

For an example about how to share a database connection across Job levels, see
Talend Studio User
Guide
.

 

Connection type

Drop-down list of available drivers:

Oracle OCI: Select this connection
type to use Oracle Call Interface with a set of C-language software
APIs that provide an interface to the Oracle database.

Oracle Service Name: Select this
connection type to use the TNS alias that you give when you connect
to the remote database.

Oracle SID: Select this connection
type to uniquely identify a particular database on a system.

Oracle Custom: Select this
connection type to access a clustered database.

 

DB Version

Select the Oracle version in use.

 

Host

IP address of the database server.

 

Port

Port number listening the database server.

 

Database

Database name.

 

Schema

Schema name.

 

Username and
Password

DB user authentication data.

To enter the password, click the […] button next to the
password field, and then in the pop-up dialog box enter the password between double quotes
and click OK to save the settings.

 

Table

Name of the table to be written. Note that only one table can be
written at a time.

 

Action on table

On the table defined, you can perform one of the following
operations:

None: No operation is carried
out.

Drop and create table: The table is
removed and created again.

Create table: The table does not
exist and gets created.

Create table if not exists: The
table is created if it does not exist.

Drop table if exists and create:
The table is removed if it already exists and created again.

Clear table: The table content is
deleted.

Truncate table: The table content
is deleted. You do not have the possibility to rollback the
operation.

 

Data file name

Name of the file to be loaded.

Warning

This file should be located on the same machine as the
database server.

 

Action on data

On the data of the table defined, you can perform:

Insert: Inserts rows to an empty
table. If duplicates are found, Job stops.

Update: Update the existing data of
the table.

Append: Adds rows to the existing
data of the table

Replace: Overwrites some rows of
the table

Truncate: Drops table entries and
inserts new input flow data.

 

Schema and Edit
Schema

A schema is a row description, it defines the number of fields to
be processed and passed on to the next component. The schema is
either Built-in or stored remotely
in the Repository.

Since version 5.6, both the Built-In mode and the Repository mode are
available in any of the Talend solutions.

Click Edit schema to make changes to the schema. If the
current schema is of the Repository type, three options are
available:

  • View schema: choose this option to view the
    schema only.

  • Change to built-in property: choose this option
    to change the schema to Built-in for local
    changes.

  • Update repository connection: choose this option to change
    the schema stored in the repository and decide whether to propagate the changes to
    all the Jobs upon completion. If you just want to propagate the changes to the
    current Job, you can select No upon completion and
    choose this schema metadata again in the [Repository
    Content]
    window.

 

 

Built-In: You create and store the schema locally for this
component only. Related topic: see Talend Studio
User Guide.

 

 

Repository: You have already created the schema and
stored it in the Repository. You can reuse it in various projects and Job designs. Related
topic: see Talend Studio User Guide.

When the schema to be reused has default values that are integers or functions, ensure that
these default values are not enclosed within quotation marks. If they are, you must remove
the quotation marks manually.

For more details, see https://help.talend.com/display/KB/Verifying+default+values+in+a+retrieved+schema.

Advanced settings

Advanced separator (for number)

Select this check box to change the separator used for the
numbers.

 

Use existing control file

Select this check box if you use a control file (.ctl) and specify
its path in the .ctl file name
field.

 

Record format

Define the record format:

Default: format parameters are set
by default.

Stream: set Record terminator.

Fixed: set the Record length.

Variable: set the Field size of the record length.

 

Specify .ctl file’s INTO TABLE clause manually

Select this check box to manually fill in the INTO TABLE clause of the control file.

 

Fields terminated by

Character, string or regular expression to separate fields:

None: no separator is used.

Whitespace: the separator used is a
space.

EOF (used for loading LOBs from
lobfile)
: the separator used is an EOF character (End
Of File).

Other terminator: Set another
terminator in the Field terminator
field.

 

Use fields enclosure

Select this check box if you want to use enclosing characters for
the text:

Fields enclosure (left part):
character delimiting the left of the field.

Field enclosure (right part):
character delimiting the right of the field.

 

Use schema’s Date Pattern to load Date field

Select this check box to use the date pattern of the schema in the
date field.

 

Specify field condition

Select this check box to define data loading condition.

 

Preserve blanks

Select this check box to preserve the blanks.

 

Trailing null columns

Select this check box to load null columns.

 

Load options

Click + to add data loading
options:

Parameter: select a loading
parameter from the list.

Value: enter a value for the
parameter selected.

 

NLS Language

In the list, select the language used for the data that are not
used in Unicode.

 

Set Parameter NLS_TERRITORY

Select this check box to modify the territory conventions used for
day and weeks numbering. Your OS value is the default value
used.

 

Encoding

Select the encoding from the list, or enter the encoding between double quotes if it does
not exist in the list. This field is compulsory for database data handling.

 

Output

Select the type of output for the standard output of the Oracle
database:

to console,

to global variable.

 

Convert columns and table names to uppercase

Select this check box to uppercase the names of the columns and
the name of the table.

 

tStatCatcher Statistics

Select this check box to collect log data at the component
level.

Dynamic settings

Click the [+] button to add a row in the table and fill
the Code field with a context variable to choose your
database connection dynamically from multiple connections planned in your Job. This feature
is useful when you need to access database tables having the same data structure but in
different databases, especially when you are working in an environment where you cannot
change your Job settings, for example, when your Job has to be deployed and executed
independent of Talend Studio.

The Dynamic settings table is available only when the
Use an existing connection check box is selected in the
Basic settings view. Once a dynamic parameter is
defined, the Component List box in the Basic settings view becomes unusable.

For more information on Dynamic settings and context
variables, see Talend Studio User Guide.

Global Variables

NB_LINE_DATA: the number of rows read. This is an After
variable and it returns an integer.

NB_LINE_BAD: the number of rows rejected. This is an
After variable and it returns an integer.

NB_LINE_INSERTED: the number of rows inserted. This is an
After variable and it returns an integer.

RETURN_CODE: the return code indicating the result of
processing. This is an After variable and it returns an integer.

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio
User Guide.

Usage

This dedicated component offers performance and flexibility of
Oracle DB query handling.

Log4j

The activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User
Guide
.

For more information on the log4j logging levels, see the Apache documentation at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html.

Limitation

The database server/client must be installed on the same machine
where the Studio is installed or where the Job using tOracleBulkExec is deployed, so that the
component functions properly.

Scenario: Truncating and inserting file data into an Oracle database

This scenario describes how to truncate the content of an Oracle database and load the
content of an input file. The related Job is composed of three components that
respectively creates the content, output this content into a file to be loaded into the
Oracle database after the database table has been truncated.

Building the Job

  1. Drop the following components: tOracleInput, tFileOutputDelimited and tOracleBulkExec from the Palette to the design workspace.

  2. Connect the tOracleInput to the tFileOutputDelimited using a Row > Main link.

  3. Connect the tOracleInput to the tOracleBulkExec using a OnSubjobOk trigger link.

Use_Case_tOracleBulkExec1.png

Configuring the components

  1. Double-click the tOracleInput to open its
    Basic settings view.

  2. Define the Oracle connection details. It is recommended to store the
    database connection details in the Metadata
    folder of the Repository tree view in order
    to retrieve them easily at any time in any Job.

    Use_Case_tOracleBulkExec2.png
  3. Define the schema, if it is not stored in the Repository. In this example, the schema contains four
    columns as follows: ID_Contract,
    ID_Client, Contract_type and
    Contract_Value.

  4. Define the tFileOutputDelimited component
    parameters, including output File Name,
    Row separator and Fields delimiter.

  5. Double-click on the tOracleBulkExec to
    define the database populating properties.

    Use_Case_tOracleBulkExec3.png
  6. In the Property Type list, select
    Repository if you stored the database
    connection details under the Metadata node
    of the Repository or select Built-in to define them manually. In this
    scenario, use the Built-in mode.

  7. Set the connection parameters in the following fields: Host, Port,
    Database, Schema, Username, and
    Password.

  8. Fill in the name of the Table to be
    populated and the Action on data to be
    carried out. In this use case, select insert.

  9. In the Schema list, select Built-in, and click the […] button next to the Edit
    schema
    field to define the structure of the data to be passed
    to the next component.

  10. Click the Advanced settings view to
    configure the advanced settings of the component.

    Use_Case_tOracleBulkExec4.png
  11. Select the Use an existing control file
    check box if you want to use a control file (.ctl) storing the status of the
    physical structure of the database. Or, fill in the following fields
    manually: Record format, Specify .ctl file’s INTO TABLE clause manually,
    Field terminated by, Use field enclosure, Use
    schema’s Date Pattern to load Date field
    , Specify field condition, Preserve blanks, Trailing null
    columns
    , Load options,
    NLS Language and Set Parameter NLS_TERRITORY according to your
    database.

  12. In the Encoding list, select the
    encoding, or enter the encoding between double quotes if it does not exist
    in the list.

  13. In the Output list, select to console to output the standard output of the
    database in the console.

Executing the Job

  1. Press Ctrl+S to save your Job.

  2. Press F6 to run the Job. The log is shown
    in the console of the Run view and the
    table is populated with the parameter file data.

Related topic: see Scenario: Inserting data in MySQL database.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x