Expert Consultancy from Yellow Pelican

Talend t[DB]Connection Reference

A site about Talend

Talend t[DB]Connection Reference

Talend provides a number of t[DB]Connection components, for establising connections to supported database vendors.

Our examples will be based on MySQL; but referring to other database vendors if helpful. The principles learned here, can be applied to all of the database vendors that Talend supports.

tMysqlConnection

Talend provides the tMysqlConnection component, for establishing a connection to a MySQL database. Although other components such as tMysqlInput and tMysqlOutput are able to establish a connection themselves, it is sensible to always delegate their connection to a database connection component. This reduces the configuration and maintenance of the many database components that you may use in your Jobs. To take this a step further, you should then look to wrap-up your connections and connection parameters in to reusable and configurable Jobs, as described in our Talend Database Tutorial.

Shared Connections

It is possible to specify a database connection as being shared. That is, other database connection components may share the connection. At first, the purpose of this may not seem clear; however, establishing a shared connection allows parent, child and sibling Jobs to reference the same connection.

There are some limitation to the use of shared connections.

  • You may not set a tRunJob component to Use an independent process to run subjob i.e. all of the Jobs that share a connection must run within the same process. This is, usually, not a limiting factor in your adoption of shared connections.
  • If you are streaming data from a tMysqlInput component, you will not be able to write to the same shared connection. In this instance, you will need to create an additional shared connection.

Auto Commit

By default, data will not be Committed to your database, unless you use a t[DB]]Commit component such as tMysqlCommit. You can alter this behaviour by checking Auto Commit, which can be found on the Advanced settings tab. This means that components such as tMysqlOutput will have their data committed every Number of rows per insert. This value can be found on the Advanced settings tab of t[DB]Output components.

You will, of course, want to determine your Commit and Rollback (t[DB]Rollback) strategy at the outset.

Downloadable Connection Job

We've made available, a downloadable Job, LibMySQLSharedConnection, and the associated tutorial Talend Database Tutorial explains how to create simple, maintainable and robust database connections.

Further Reading

Read our tutorial Working with Databases, to get a good understanding of how this family of database connection components are used.

The following is a sample screenshot shows a simple usage of this component.

Image 11




Expert Consultancy from Yellow Pelican
comments powered by Disqus

© www.TalendByExample.com