August 17, 2023

tAccessConnection – Docs for ESB 5.x

tAccessConnection

tAccessConnection_icon32_white.png

tAccessConnection Properties

Component family

Databases/Access

 

Function

Opens a connection to the database for a current
transaction.

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
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.

 

DB Version

Access 2003 or later versions.

 

Database

Name of the database.

 

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.

 

Use or register a shared DB Connection

Select this check box to share your connection or fetch a
connection shared by a parent or child Job. This allows you to share
one single DB connection among several DB connection components from
different Job levels that can be either parent or child.

Warning

This option is incompatible with the Use dynamic job
and Use an independent process to run subjob options of
the tRunJob component. Using a shared connection
together with a tRunJob component with either of these
two options enabled will cause your Job to fail.

Shared DB Connection Name: set or
type in the shared connection name.

Advanced settings

Additional JDBC parameters

Specify additional connection properties for the DB connection you
are creating.

Usage

This component is more commonly used with other tAccess*
components, especially with the tAccessCommit and tAccessRollback components.

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

If you are using the 64-bit version of the Studio, you should use
the 32-bit versions of the ODBC driver and of the Java
environment.

Scenario: Inserting data in parent/child tables

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.

Use_Case_tAccessConnection1.png
  • 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
    .

    use_case-taccessconnection2.png
  • 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.

Use_Case_tAccessConnection3.png
  • 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.

Use_Case_tAccessConnection4.png
  • 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.

Use_Case_tAccessConnection5.png

The parent table Table1 is reused to generate the
Name table and Birthday table.


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