There are two data types in the database component schema: the Talend type and the DB type. When retrieving the table schema, there is always a default Talend type to map to the real DB type. Also, there is a default DB type to map to the Talend type on the DB schema, when linking a non-DB component to a DB output component. You can modify the default data type mapping for your project rather than changing it manually every time.
This procedure was written with:
Talend verified this procedure to be compatible with Talend Studio version 6.3.1 or higher versions.
A Talend type is an intermediate Java type, mapped for each data type of different databases. These default data type mappings are configured in an XML file. Each kind of database has a separate mapping configuration file. For example, the file mapping_Mysql.xml maps MySQL data types to Talend types.
A portion of the mapping for a MySQL database is as follows. The DB type DECIMAL will map to the Talend type Float by default when retrieving the table schema.
... <dbToTalendTypes> ... <dbType type="DECIMAL"> <talendType type="id_Float" default="true" /> <talendType type="id_Double"/> <talendType type="id_BigDecimal"/> </dbType> ...
To change the default data type mapping, follow these steps (using a MySQL database as an example):
Click Edit to edit the file. Change the default mapping. In this example, map the DB type DECIMAL to the Talend type BigDecimal by default, as follows:
... ... <dbType type="DECIMAL"> <talendType type="id_Float"/> <talendType type="id_Double"/> <talendType type="id_BigDecimal" default="true"/> </dbType> ...