[resolved] tMSSqlOutputBulkExec: Mapping datatype boolean to bit does not work

One Star

[resolved] tMSSqlOutputBulkExec: Mapping datatype boolean to bit does not work

Hello,
i have a java TOS project.
When reading the schema information from the MS-SQL-Server database the type bit is mapped to the java type boolean. That's o.k.
But when using the tMSSqlOutputBulkExec component to write data to the MS-SQL-Server
- the file generated contains 'true' or 'false' (without the ') in the boolean columns
- and an error "not able to convert" is raised

So it seems that the values 'true' / 'false' are not mapped to 1 / 0 in the database.
If this implicit mapping is not possible then i would prefer that the mapping when reading the schema information should be "bit => int" and not "bit => boolean".
Regards Hartmut

Accepted Solutions
Community Manager

Re: [resolved] tMSSqlOutputBulkExec: Mapping datatype boolean to bit does not work

Hello
If this implicit mapping is not possible then i would prefer that the mapping when reading the schema information should be "bit => int" and not "bit => boolean".

You can change data type mapping, go to Windows-->Preferences--->Talend-->Specific Settings-->metadata of TalendType, open mapping_MSSQL.xml and modify it:

...
<language name="java">
...
<dbToTalendTypes><!-- Adviced mappings -->
...
<dbType type="BIT">
<talendType type="id_Boolean" default="true" />
<talendType type="id_Byte" />
</dbType>

Change to :

...
<language name="java">
...
<dbToTalendTypes><!-- Adviced mappings -->
...
<dbType type="BIT">
<talendType type="id_Integer" default="true" /> //add this line and set it as true by default
<talendType type="id_Boolean" />
<talendType type="id_Byte" />
</dbType>

Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] tMSSqlOutputBulkExec: Mapping datatype boolean to bit does not work

Hello
If this implicit mapping is not possible then i would prefer that the mapping when reading the schema information should be "bit => int" and not "bit => boolean".

You can change data type mapping, go to Windows-->Preferences--->Talend-->Specific Settings-->metadata of TalendType, open mapping_MSSQL.xml and modify it:

...
<language name="java">
...
<dbToTalendTypes><!-- Adviced mappings -->
...
<dbType type="BIT">
<talendType type="id_Boolean" default="true" />
<talendType type="id_Byte" />
</dbType>

Change to :

...
<language name="java">
...
<dbToTalendTypes><!-- Adviced mappings -->
...
<dbType type="BIT">
<talendType type="id_Integer" default="true" /> //add this line and set it as true by default
<talendType type="id_Boolean" />
<talendType type="id_Byte" />
</dbType>

Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] tMSSqlOutputBulkExec: Mapping datatype boolean to bit does not work

Hello Shong,
thank you very much for this information!
I wish all the best for 2010.
Regards Hartmut