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.
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:
- 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.
Connect each tMysqlConnection to the relevant component in your Jobs using a
Trigger > On Subjob Ok link.
- 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.
Select the Use or register a shared
DB Connection check box, and give a name to the connection in
the Shared DB Connection Name
You are now able to re-use the connection in your child Job.
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.
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.