Sharing a database connection - Cloud - 7.3

Talend Studio User Guide

Version
Cloud
7.3
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development
Last publication date
2024-02-13

About this task

If you have various Jobs using the same database connection, you can factorize the connection by using the Use or register a shared DB Connection option so that the connection can be shared between parent and child Jobs.

This option has been added to all database connection components in order to reduce the number of connections to open and close.

Warning: The Use or register a shared DB Connection option of all database connection components is incompatible with the Use dynamic job and Use an independent process to run subJob options of the tRunJob component. Using a shared database connection together with a tRunJob component with either of these two options enabled will cause your Job to fail.

The procedure below assumes that you have two related Jobs (a parent Job and a child Job) that both need to connect to your remote MySQL database.

For a complete use case, see MySQL.

To use a shared database connection in the two Jobs, to the following:

Procedure

  1. Add a tMysqlConnection (assuming that you work with a MySQL database) to both the parent and the child Job, if they are not using a database connection component.
  2. Connect each tMysqlConnection to the relevant component in your Jobs using a Trigger > On Subjob Ok link.
  3. In the Basic settings view of the tMysqlConnection component that will run first, fill in the database connection details if the database connection is not centrally stored in the Repository.
  4. Select the Use or register a shared DB Connection check box, and give a name to the connection in the Shared DB Connection Name field.
    You are now able to re-use the connection in your child Job.
  5. In the Basic settings view of the other tMysqlConnection component, which is in the other Job, simply select Use or register a shared DB Connection check box, and fill the Shared DB Connection Name field with the same name as in the parent Job.
    Note:

    Among the different Jobs sharing the same database connection, you need to define the database connection details only in the first Job that needs to open the database connection.