GitHubContribute in GitHub: Edit online

Db2 Extraction Fails with java.io.CharConversionException, ERRORCODE=-4220, SQLSTATE=null

Problem

The database extraction reports errors about character conversion java.nio.charset.MalformedInputException: Input length = 1. The complete error message is as follows.

2023-09-01 13:42:39.228 [CLI] 0 ERROR eu.profinit.manta.connector.db2.extractor.Db2ExtractorImpl 
EXTRACTION_ERRORS CANNOT_FETCH_FROM_DATABASE
User message: Error fetching tables from database.
Technical message: Error fetching tables from database.
Solution: Please contact MANTA Support at portal.getmanta.com and submit a support bundle/log export.
Impact: SCENARIO

eu.profinit.manta.connector.db2.extractor.exceptions.Db2ExtractorDaoException: org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column 'REMARKS' from result set.  Cause: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.21.29] Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
; uncategorized SQLException; SQL state [null]; error code [-4220]; [jcc][t4][1065][12306][4.21.29] Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null; nested exception is com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.21.29] Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
    at eu.profinit.manta.connector.db2.extractor.dao.Db2DaoBase.getAllTables(Db2DaoBase.java:359) ~[?:?]
    at eu.profinit.manta.connector.db2.extractor.Db2ExtractorImpl.extractObjectWithDepencencies(Db2ExtractorImpl.java:179) ~[?:?]
    at eu.profinit.manta.connector.db2.extractor.Db2ExtractorImpl.extract(Db2ExtractorImpl.java:143) ~[?:?]
    at eu.profinit.manta.connector.db2.extractor.Db2ExtractorWithZosFallback.extract(Db2ExtractorWithZosFallback.java:43) ~[?:?]
    at eu.profinit.manta.connector.db2.extractor.scenario.Db2ExtractorReader.read(Db2ExtractorReader.java:44) ~[?:?]
    at eu.profinit.manta.connector.db2.extractor.scenario.Db2ExtractorReader.read(Db2ExtractorReader.java:21) ~[?:?]
    at eu.profinit.manta.connector.common.extractor.scenario.ExtractorScenario.doExecute(ExtractorScenario.java:63) ~[?:?]
    at eu.profinit.manta.platform.automation.AbstractScenario.execute(AbstractScenario.java:107) ~[manta-platform-automation-41.0.0.jar:?]
    at eu.profinit.manta.platform.cli.CliImpl.execute(CliImpl.java:249) ~[manta-platform-cli-41.0.8.jar:?]
    at eu.profinit.manta.platform.cli.launcher.Main.lambda$main$1(Main.java:66) ~[manta-platform-cli-launcher-41.0.8.jar:41.0.8]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column 'REMARKS' from result set.  Cause: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.21.29] Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
; uncategorized SQLException; SQL state [null]; error code [-4220]; [jcc][t4][1065][12306][4.21.29] Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null; nested exception is com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.21.29] Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92) ~[?:?]
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441) ~[?:?]
    at jdk.proxy3.$Proxy55.selectList(Unknown Source) ~[?:?]
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224) ~[?:?]
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147) ~[?:?]
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80) ~[?:?]
    at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) ~[?:?]
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) ~[?:?]
    at jdk.proxy3.$Proxy67.selectAllTables(Unknown Source) ~[?:?]
    at eu.profinit.manta.connector.db2.extractor.dao.Db2DaoBase.getAllTables(Db2DaoBase.java:346) ~[?:?]
    ... 10 more
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.21.29] Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
    at com.ibm.db2.jcc.am.kd.a(kd.java:794) ~[?:?]
    at com.ibm.db2.jcc.am.kd.a(kd.java:66) ~[?:?]
    at com.ibm.db2.jcc.am.kd.a(kd.java:125) ~[?:?]
    at com.ibm.db2.jcc.am.mc.a(mc.java:2963) ~[?:?]
    at com.ibm.db2.jcc.am.mc.p(mc.java:575) ~[?:?]
    at com.ibm.db2.jcc.am.mc.P(mc.java:1656) ~[?:?]
    at com.ibm.db2.jcc.am.ResultSet.getStringX(ResultSet.java:1214) ~[?:?]
    at com.ibm.db2.jcc.am.ResultSet.getString(ResultSet.java:1183) ~[?:?]
    at com.ibm.db2.jcc.am.ResultSet.getString(ResultSet.java:1773) ~[?:?]
    at org.apache.commons.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:898) ~[commons-dbcp2-2.7.0.jar:2.7.0]
    at org.apache.commons.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:898) ~[commons-dbcp2-2.7.0.jar:2.7.0]
    at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:37) ~[?:?]
    at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:26) ~[?:?]
    at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:85) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createRowKeyForMappedProperties(DefaultResultSetHandler.java:1058) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createRowKey(DefaultResultSetHandler.java:1020) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyNestedResultMappings(DefaultResultSetHandler.java:947) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:435) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForNestedResultMap(DefaultResultSetHandler.java:910) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:327) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:302) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:195) ~[?:?]
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65) ~[?:?]
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[?:?]
    at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) ~[?:?]
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) ~[?:?]
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[?:?]
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) ~[?:?]
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89) ~[?:?]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151) ~[?:?]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145) ~[?:?]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) ~[?:?]
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:577) ~[?:?]
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427) ~[?:?]
    at jdk.proxy3.$Proxy55.selectList(Unknown Source) ~[?:?]
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224) ~[?:?]
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147) ~[?:?]
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80) ~[?:?]
    at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) ~[?:?]
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) ~[?:?]
    at jdk.proxy3.$Proxy67.selectAllTables(Unknown Source) ~[?:?]
    at eu.profinit.manta.connector.db2.extractor.dao.Db2DaoBase.getAllTables(Db2DaoBase.java:346) ~[?:?]
    ... 10 more
Caused by: java.nio.charset.MalformedInputException: Input length = 1
    at java.nio.charset.CoderResult.throwException(CoderResult.java:274) ~[?:?]
    at com.ibm.db2.jcc.am.r.a(r.java:52) ~[?:?]
    at com.ibm.db2.jcc.am.mc.a(mc.java:2952) ~[?:?]
    at com.ibm.db2.jcc.am.mc.p(mc.java:575) ~[?:?]
    at com.ibm.db2.jcc.am.mc.P(mc.java:1656) ~[?:?]
    at com.ibm.db2.jcc.am.ResultSet.getStringX(ResultSet.java:1214) ~[?:?]
    at com.ibm.db2.jcc.am.ResultSet.getString(ResultSet.java:1183) ~[?:?]
    at com.ibm.db2.jcc.am.ResultSet.getString(ResultSet.java:1773) ~[?:?]
    at org.apache.commons.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:898) ~[commons-dbcp2-2.7.0.jar:2.7.0]
    at org.apache.commons.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:898) ~[commons-dbcp2-2.7.0.jar:2.7.0]
    at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:37) ~[?:?]
    at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:26) ~[?:?]
    at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:85) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createRowKeyForMappedProperties(DefaultResultSetHandler.java:1058) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createRowKey(DefaultResultSetHandler.java:1020) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyNestedResultMappings(DefaultResultSetHandler.java:947) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:435) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForNestedResultMap(DefaultResultSetHandler.java:910) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:327) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:302) ~[?:?]
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:195) ~[?:?]
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65) ~[?:?]
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[?:?]
    at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) ~[?:?]
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) ~[?:?]
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[?:?]
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) ~[?:?]
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89) ~[?:?]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151) ~[?:?]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145) ~[?:?]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) ~[?:?]
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:577) ~[?:?]
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427) ~[?:?]
    at jdk.proxy3.$Proxy55.selectList(Unknown Source) ~[?:?]
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224) ~[?:?]
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147) ~[?:?]
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80) ~[?:?]
    at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) ~[?:?]
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) ~[?:?]
    at jdk.proxy3.$Proxy67.selectAllTables(Unknown Source) ~[?:?]
    at eu.profinit.manta.connector.db2.extractor.dao.Db2DaoBase.getAllTables(Db2DaoBase.java:346) ~[?:?]
    ... 10 more

Solution

This occurs when data is accessed in a database table encoded with a character set that is not compatible with the default used by the JDBC driver. According to https://www.ibm.com/support/pages/sqlexception-message-caught-javaiocharconversionexception-and-errorcode-4220.

  1. For R41 and prior - this can be fixed by providing an additional configuration for the Db2 JDBC driver as follows:

    1. Navigate to Admin UI → Process Manager and locate (all applicable) workflows that include the Db2 extractor scenario for the affected connection(s).
    2. Configure the JAVA_OPTS variable with the value specifically for this scenario or any level above it. (It will only be picked up by Db2.) Enter -Ddb2.jcc.charsetDecoderEncoder=3 as the value. No alt text provided
  2. For R42 - no workaround available.