Writing to a database table
Writing to tables using Talend can seem very simple, but in fact is a very big topic, since different databases have multiple modes of writing to tables. In this simple recipe, we'll perform a basic write of data to a table as a basis for a much deeper conversation regarding this very important database requirement.
Getting ready
Open the job jo_cook_ch07_0040_writingTable
.
How to do it…
The steps to be performed are as follows:
Open the cookbookDB connection and drag the schema for the table
customer
to the canvas.Select the Component
tMysqlOutput
.Open
tMysqlOutput
and change Table tocustomerWriteTest
.Connect it to
tFileInputDelimited
.Run the job and you will get the message Table'cookbookdb.customer_write_test' doesn't exist.
Open
tMysqlOutput
and change Action on table to Create table if not exists.Run the job again and you will see that the table
customer_write_test
has been created.Run the job again and you will see that the job fails with the message Duplicate...