Search code examples
talend

Talend Bulk load data conversion error on Boolean field


I have a Talend job that uses MS SQL Bulk load:

enter image description here

I'm mapping a boolean field in this way:

enter image description here

and here is the boolean variable isVisible assignation:

enter image description here

On executing the job, I get this error:

Exception in component tMSSqlBulkExec_1 (produits)
java.sql.SQLException: Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 126 (isVisible).
    at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
    at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
    at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
    at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613)
    at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572)
    at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:809)
    at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1282)
    at elcom.produits_0_6.produits.tMSSqlBulkExec_1Process(produits.java:25289)
    at elcom.produits_0_6.produits.tMSSqlInput_6Process(produits.java:24970)
    at elcom.produits_0_6.produits.tMSSqlConnection_1Process(produits.java:2595)
    at elcom.produits_0_6.produits.tMSSqlConnection_3Process(produits.java:2430)
    at elcom.produits_0_6.produits.runJobInTOS(produits.java:44123)
    at elcom.produits_0_6.produits.main(produits.java:43718)

However, the value is the CSV file seems to be correct:

enter image description here

Any help is appreciated. Thanks.


Solution

  • SQL Server is having trouble recognizing "true" and "false" literals as booleans. Try using an integer (or byte) type in your output; and mapping it with 0 (for false) and 1 (for true).