JDBC throws java.io.CharConversionException

Sometimes the afuIndexer process unexpectedly throws a Java exception during document processing and indexing.

Symptoms

The following error message is logged:
"afuIndexer[worker]: [12/01/19 15:00:50] Error:
	An SQL error has occurred with the following reason:
	[jcc][t4][1065][12306][3.63.75] Caught
	java.io.CharConversionException.  See attached Throwable
	for details. ERRORCODE=-4220, SQLSTATE=null"
If trace is enabled or afuIndexer is run in debug mode, the following additional information is logged:
com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][3.62.57] 
	Caught java.io.CharConversionException.  
See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.db2.jcc.am.fd.a(fd.java:660)
at com.ibm.db2.jcc.am.fd.a(fd.java:60)
at com.ibm.db2.jcc.am.fd.a(fd.java:112)
at com.ibm.db2.jcc.am.ic.a(ic.java:2222)
at com.ibm.db2.jcc.am.ic.p(ic.java:519)
at com.ibm.db2.jcc.am.ic.N(ic.java:1524)
at com.ibm.db2.jcc.am.ym.e(ym.java:1147)
at com.ibm.db2.jcc.am.ym.getString(ym.java:1122)
at com.ibm.afu.ftsidx.shared.database.DbQuery.getStringResultValue(DbQuery.java:124)
at com.ibm.afu.ftsidx.shared.database.DbBaseQueryMethods.
	selectForTargetItemDocumentParts(DbBaseQueryMethods.java:627)

Causes

This unexpected exception is caused by a problem in the DB2 JDBC driver. The JDBC driver is part of DB2 and is used by the afuIndexer process to communicate with DB2. The exception can occur if the TIEREF value for a given item contains special characters that the JDBC driver cannot handle correctly.

Resolving the problem

  1. Ensure that the DB2 JDBC driver that you are using is one of the following versions:
    • 3.63.81
    • 3.62.57 (DB2 9.5 FP 8 current customer version)

    The JDBC driver that you use must address APAR IC74895 which is included in DB2 V95 FP8. If you are not using DB2 V95 FP8, ensure that you install a JCC driver that includes the fix for this APAR.

  2. Add the following line to the indexer configuration file for all affected item types (all affected item_type_name.ini files) under the [Settings] section:
    *RmiJavaArguments =-Ddb2.jcc.charsetDecoderEncoder=3
    

    This internal and undocumented configuration option *RmiJavaArguments can be used to pass additional definitions to the JVM of the indexer worker processes. Using the given configuration value, the definition db2.jcc.charsetDecoderEncoder=3 is passed to all worker JVMs which prevents the exception from occurring in DB2 JDBC.