DB2 - Problem description
Problem IC74895 | Status: Closed |
DB2 JCC DRIVER MIGHT THROW EXCEPTION "JAVA.IO.CHARCONVERSIONEXCEPTION". | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
JCC driver throws the exception if fails to convert character. A typical scenario is some application using "ResultSet.getString" method to retrieve character strings from database and there are invalid characters in the string. By default, JCC driver uses "sun.io.*" methods to manipulate character strings. According to the standards for ""sun.io", it should throw the exception when fails to convert character strings (e.g. invalid characters that can not be converted). In the fix of the APAR, JCC driver introduces a global property named "db2.jcc.charsetDecoderEncoder" of type integer which could be set as follows: =========================================== 1: This is the default. "sun.io.ByteToCharConverter" and/or "sun.io.CharToByteConverter" will be used if following classes could be loaded successfully: -- sun.io.ByteToCharConverter -- sun.io.CharToByteConverter -- sun.io.MalformedInputException -- sun.io.ConversionBufferFullException -- sun.io.UnknownCharacterException "java.nio.charset.CharsetDecoder" and/or "java.nio.charset.CharsetEncoder" will be used with "java.nio.charset.CodingErrorAction.REPORT" otherwise. 2: "java.nio.charset.CharsetDecoder" and/or "java.nio.charset.CharsetEncoder" will be used with "java.nio.charset.CodingErrorAction.REPORT". 3: "java.nio.charset.CharsetDecoder" and/or "java.nio.charset.CharsetEncoder" will be used with "java.nio.charset.CodingErrorAction.REPLACE". not defined or any other values: The default value will be used. =========================================== To avoid the exception, you need to specify value 3 for the global property "db2.jcc.charsetDecoderEncoder". By this way, JCC converts invalid characters to NULL instead of throwing exceptions, using "java.nio.charset.CodingErrorAction.REPLACE" in case of error. You can add following line into your Java property file if you already have one: db2.jcc.charsetDecoderEncoder=3 or specify "-Ddb2.jcc.charsetDecoderEncoder=3" on Java command line. | |
Problem Summary: | |
Fixed in DB2 V9.7 FP5 JDBC drivers. | |
Local Fix: | |
Remove invalid characters from the string stored in database. | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows | |
Solution | |
Upgrade the JDBC drivers to DB2 V9.7 FP5 drivers or above. | |
Workaround | |
not known / see Local fix | |
BUG-Tracking | |
forerunner : APAR is sysrouted TO one or more of the following: IC74896 follow-up : | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 07.03.2011 08.04.2015 08.04.2015 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP5 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.5 |