Component family |
Databases/Access |
|
Function |
Opens a connection to the database for a current |
|
Purpose |
This component is used to open a connection to the specified database that can then be reused in the subsequent subjob or subjobs. |
|
Basic settings |
Property type |
Either Built-in or Since version 5.6, both the Built-In mode and the Repository mode are |
|
|
Built-in: No property data stored |
|
|
Repository: Select the repository |
|
DB Version |
Access 2003 or later versions. |
|
Database |
Name of the database. |
|
Username and |
DB user authentication data. To enter the password, click the […] button next to the |
|
Use or register a shared DB Connection |
Select this check box to share your connection or fetch a WarningThis option is incompatible with the Use dynamic job
Shared DB Connection Name: set or |
Advanced settings |
Additional JDBC parameters |
Specify additional connection properties for the DB connection you |
Usage |
This component is more commonly used with other tAccess* |
|
Log4j |
The activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User 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 |
If you are using the 64-bit version of the Studio, you should use |
The following Job is dedicated to advanced database users, who want to carry out
multiple table insertions using a parent table Table1 to generate
two child tables: Name and Birthday.
-
In Access 2007, create an Access database named
Database1. -
Once the Access database is created, create a table named
Table1 with two column headings:
Name and Birthday.
Back into the Integration perspective of Talend Studio,
the Job requires twelve components including tAccessConnection, tAccessCommit,
tAccessInput, tAccessOutput and tAccessClose.
-
Drop the following components from the Palette to the design workspace: tFileList, tFileInputDelimited,
tMap, tAccessOutput (two), tAccessInput (two), tAccessCommit, tAccessClose and
tLogRow (x2). -
Connect the tFileList component to the input
file component using an Iterate link. Thus, the
name of the file to be processed will be dynamically filled in from the
tFileList directory using a global
variable. -
Connect the tFileInputDelimited component to
the tMap component and dispatch the flow
between the two output Access components. Use a Row link for each of these connections representing the main
data flow. -
Set the tFileList component properties, such
as the directory where files will be fetched from. -
Add a tAccessConnection component and
connect it to the starter component of this Job. In this example, the tFileList component uses an OnComponentOk link to define the execution order. -
In the tAccessConnection Component view, set
the connection details manually or fetch them from the Repository if you centrally store them as a
Metadata DB connection entry. For more information about Metadata, see
Talend Studio User
Guide. -
In the tFileInputDelimited component’s
Basic settings view, press Ctrl+Space bar to access the variable list. Set the
File Name field to the global variable:
tFileList_1.CURRENT_FILEPATH. For more information
about using variables, see Talend Studio User
Guide.
-
Set the rest of the fields as usual, defining the row and field separators
according to your file structure. -
Then set the schema manually through the [Edit
schema] dialog box or select the schema from the
Repository. Make sure the data
type is correctly set, in accordance with the nature of the data
processed. -
In the tMap Output area, add two output
tables, one called Name for the Name
table, the second called Birthday, for the
Birthday table. For more information about the
tMap component, see Talend Studio User Guide. -
Drag the Name column from the Input area, and drop it to the Name
table. -
Drag the Birthday column from the Input area, and drop it to the Birthday
table.
-
Then connect the output row links to distribute the flow correctly to the
relevant DB output components. -
In each of the tAccessOutput components’
Basic settings view, select the Use an existing connection check box to retrieve the
tAccessConnection details.
-
Set the Table name making sure it
corresponds to the correct table, in this example either
Name or Birthday. -
There is no action on the table as they are already created.
-
Select Insert as Action on data for both output components.
-
Click on Sync columns to retrieve the schema
set in the tMap. -
Then connect the first tAccessOutput
component to the first tAccessInput component
using an OnComponentOk link. -
In each of the tAccessInput components’
Basic settings view, select the Use an existing connection check box to retrieve the
distributed data flow. Then set the schema manually through [Edit schema] dialog box. -
Then set the Table Name accordingly. In
tAccessInput_1, this will be
Name. -
Click on the Guess Query.
-
Connect each tAccessInput component to
tLogRow component with a Row > Main link.
In each of the tLogRow components’ basic settings view, select Table in the Mode field. -
Add the tAccessCommit component below the
tFileList component in the design workspace
and connect them together using an OnComponentOk link in order to terminate the Job with the
transaction commit. -
In the basic settings view of tAccessCommit component and from the Component list, select the connection to be used,
tAccessConnection_1 in this
scenario. -
Save your Job and press F6 to execute
it.
The parent table Table1 is reused to generate the
Name table and Birthday table.