Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ganeshK
Contributor
Contributor

Equvalent data type for nvarchar in tDBOutput for DB2 database

Hi,

I am reading file input and insert into DB2 database table. One scenario i got input is lie below and received error in talend job tDBOutput component.

DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC: null

[ERROR]: Project.X_l_subjob_0_1.X_L_Subjob - tDBOutput_1 - DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC: null

DB2 table column datatype - char(20)

Input Type - String

tDBOutput - Type - String , DB Type - varchar

File input value - 00625一1020504人0325

Labels (2)
3 Replies
XJ_1630
Contributor III
Contributor III

 

Hi @not specified not specified​ 

 

It seems that:

  • your target DB2 columns is a CHAR(20)
  • your input string has 23 characters

 

trim your string, or increase the size of column

another point to have in mind: values in a DB2 char() will be PADDED with spaces to the full length, if they are shorter than 20 chars in length

ganeshK
Contributor
Contributor
Author

Hi,

I am already doing Stringhandling.left(InputValue,20)

 

Main problem is the special characters in input value, looks some messy values. It is not working with varchar in tDBOutput component.

 

tDBOutput - Type - String , DB Type - varchar

 

File input value - 00625一1020504人0325

 

tLogRow output after trim -> 00625Àž€1020504À 

Anonymous
Not applicable

Hi

What encoding do you use to read the value from input file? By default, it is 'ISO-8859-15', have a try to change it to UTF-8 or other type that matches the string encoding. This properties is located in the advanced settings panel of tFileInputXXX component.

 

Regards

Shong