July 30, 2023

tAccessConnection – Docs for ESB 7.x

tAccessConnection

Opens a connection to the specified database that can then be reused in the
subsequent subjob or subjobs.

tAccessConnection opens a connection to the database for
a current transaction.

tAccessConnection Standard properties

These properties are used to configure tAccessConnection running in the Standard Job framework.

The Standard
tAccessConnection component belongs to the Databases and the ELT families.

The component in this framework is available in all Talend
products
.

Note: This component is a specific version of a dynamic database
connector. The properties related to database settings vary depending on your database
type selection. For more information about dynamic database connectors, see Dynamic database components.

Basic settings

Database

Select a type of database from the list and click
Apply.

Property type

Either Built-in or
Repository
.

 

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
database connection or fetch a database connection shared by a parent or child Job,
and in the Shared DB Connection Name field displayed, enter the
name for the shared database connection. This allows you to share one single database
connection (except the database schema setting) among several database connection
components from different Job levels that can be either parent or child.

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.

Advanced settings

Additional JDBC parameters

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

Usage

Usage rule

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

Limitation

If you are using an ODBC driver, you need to work with Java 7, and make sure that your JVM
and ODBC versions match up: both 64-bit or 32-bit.

When working with Java 8, this component supports only the General collation mode of
Access.

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.

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

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

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

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

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