Component family
|
Databases/OleDb
|
|
Function
|
This component writes, updates, makes changes or suppresses entries in a
database.
|
Purpose
|
This component executes the action defined on the table and/or on the data contained in
the table, based on the flow incoming from the preceding component
in the Job.
|
Basic settings
|
Database
|
Enter the connection string used to open the database. For details, please see http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection.connectionstring.aspx.
|
|
Table
|
Specify the name of the table to be written. Note that only one table can be written at
a time.
|
|
Action on data
|
Select one of the following actions that you want to perform on the data from the
drop-down list.
-
Insert: insert
data.
-
Update: update
data.
-
Insert or update:
insert a new record. If the record with the given
reference already exists, an update would be
made.
-
Update or insert:
update the record with the given reference. If the
record does not exist, a new record would be
inserted.
-
Delete: delete
data.
Warning
It is necessary to specify at least one
column as a primary key on which the Update or Delete operation is based. You can do that
by clicking Edit schema and
selecting the check box(es) next to the column(s) you want
to set as primary key(s). For an advanced use, click the
Advanced settings view
where you can simultaneously define primary keys for the
Update or Delete operation. To do that,
select the Use field
options check box and then in the Key in update or Key in delete column, select the
check box(es) next to the column name(s) you want to use as
a base for the Update or Delete operation.
Note
The dynamic schema feature can be used in the following modes: Insert, Update,
Insert or update, Update or insert, Delete.
|
|
Clear data in table
|
Select this check box to delete data in the defined table before any operation.
|
|
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.
|
|
|
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.
|
|
|
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.
|
Advanced settings
|
Additional columns
|
This option allows you to call SQL functions to perform actions on columns, provided
that these are not insert, update or delete actions, or actions that
require pre-processing.
-
Name: Type in the name of
the schema column to be altered or inserted.
-
SQL expression: Type in the SQL statement to be
executed in order to alter or insert the data in the
corresponding column.
-
Position: Select Before, After or Replace, depending on the action to be
performed on the reference column.
-
Reference column: Type in a reference column used to
locate or replace the new column, or the column to be
modified.
This option is not available if you have just created the DB table
(even if you delete it beforehand).
|
|
Use field options
|
Select this check box to customize a request, especially if multiple actions are being
carried out on the data.
|
|
Field options
|
Select the check box(es) in the table if you want to use the
corresponding schema column(s) as a base for your operation.
-
Key in update: define the primary key to use in an
update operation.
-
Key in delete: define the
primary key to use in a delete operation.
-
Updatable: define the
column(s) to update.
-
Insertable: define the
column(s) to insert.
This field appears only when the Use field
options check box is selected.
|
|
Enable debug mode
|
Select this check box to display each step involved in the process
of writing data in the database.
|
|
tStatCatcher Statistics
|
Select this check box to collect log data at the component
level.
|
Global Variables
|
NB_LINE: the number of rows processed. This is an After
variable and it returns an integer.
NB_LINE_UPDATED: the number of rows updated. 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.
NB_LINE_DELETED: the number of rows deleted. This is an
After variable and it returns an integer.
NB_LINE_REJECTED: the number of rows rejected. This is an
After variable and it returns an integer.
QUERY: the SQL query statement processed. This is an After
variable and it returns a string.
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 component is normally an end component of a Job and always needs an input
link.
|
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.
|