How to resolve error "Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null" in TIBCO Data Virtualization?

How to resolve error "Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null" in TIBCO Data Virtualization?

book

Article ID: KB0070233

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization All supported versions

Description

When working with the DB2 data source the below exception can be seen in the TIBCO Data Virtualization studio:
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.32.28] Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null

Issue/Introduction

This article explains the exception message which might pop up on the TIBCO Data Virtualization studio while working with DB2 data source.

Environment

All supported environment

Resolution

The error occurs when an application uses the IBM Data Server Driver for JDBC and SQLJ (also known as the JCC driver) and is connected to a database with code set UTF-8 (code page 1208), it throws a SqlException with a message including 'Caught java.io.CharConversionException" and ERRORCODE=-4220 if the data in a character column that it queries contains a sequence of bytes that is not a valid UTF-8 string.'

To resolve this the flag '-Ddb2.jcc.charsetDecoderEncoder=3' needs to be added to the JVM's command line arguments. Follow the below steps to activate the script_env.sh/bat file and add the Java option to it:
 
(1)  Stop the TIBCO Data Virtualization Server.
(2)  Navigate to [TDV_Server_dir]/conf directory where the script_env.bat.sample file is present.
(3)  Make a copy of the script_env.bat.sample file in the same directory and name it "script_env.bat".
(4)  Open script_env.bat with a text editor, and uncomment the last line (i.e. remove the 'rem' prefix):
CIS_SERVER_VM_ARGS=
(5)  Change the value of CIS_SERVER_VM_ARGS to include all the existing values in VM_ARGS from <TDV_install_dir>/conf/server/server.properties.
For Windows, this would be the "windows.vmargs=" line
Example:
CIS_SERVER_VM_ARGS="-server -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:/Program Files/TIBCO/TDV Server 8.5/logs -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xmx16000m"
NOTE: Make sure to add double quotes around the value specified for CIS_SERVER_VM_ARGS.
 
(6)   Append the following to the CIS_SERVER_VM_ARGS line:
-Ddb2.jcc.charsetDecoderEncoder=3
Example:
set CIS_SERVER_VM_ARGS="-server -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:/Program Files/TIBCO/TDV Server 8.5/logs -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xmx16000m -Ddb2.jcc.charsetDecoderEncoder=3"
Note: All the flags in the CIS_SERVER_VM_ARGS should be in a single line in the script_env.bat file.
(7)  Start the TIBCO Data Virtualization Server.

Additional Information