Committing to a MySQL Database in Talend Studio

by | Apr 7, 2015 | BlogPosts

Case Scenario

You might have come across an issue in Talend Studio when using a MySQL standard Talend component. The issue being an incorrect commit to the database resulting in some rows being left out of the commit statement. For instance if you insert 2633 rows of data into a MySQL Database table and perform a commit using a standard Talend component straight after, then the table will actually commit only 2600 rows.

Trying to switch between different row types like: “main”, “trigger” or “On Component Ok” will not help.

Solutions

There are three ways with which it is possible to overcome the issue.

  1. If you are using a “tMysqlConnection” Talend component then you can add an “Auto commit” option in the “Advanced settings”. However this approach should only be used if your inserts are going to be insubstantial in size, because the commit will be initiated after each row insert. Thus the speed of the Talend job will be drastically reduced while the commits are happening ;
  2. The second option is to add a component between the “tMysqlOutput” and “tMysqlCommit”. For instance “tMsgBox”. Then all of the values will be committed;
  3. The last option is to use an “if” trigger between the “tMysqlOutput” and “tMysqlCommit”. You can use something trivial like 1 == 1;

0 Comments