Issue Information
| Issue Number | 701255a |
| Issue | When the application JVM is upgraded to JDK 18 or later in an environment where the default encoding is not UTF-8 (such as MS949 or EUC-KR), character data is stored differently than intended in updatable ResultSets and RowSets. No error occurs in this case. This occurs only when the input Java type and column type are different. When updateBytes() is used to store data in a character-type column, the data is changed to the Unicode replacement character (U+FFFD). When updateString() is used to store data in a RAW column, the stored bytes differ from those before the JDK upgrade. The same issue occurs with updateObject() and when retrieving data through the CachedRowSet family. PreparedStatement setString()/setBytes() bindings and regular SELECT queries are not affected. |
| Cause | Starting with JDK 18, the JVM default encoding is fixed to UTF-8 regardless of the OS locale, in accordance with JEP 400. Some tbjdbc conversion paths do not specify an encoding and use the JVM default encoding, causing data provided by the application to be interpreted using a different encoding after the JDK upgrade. |
| Solutions | The encoding-handling logic is unified, and the existing default encoding is applied for JDK 17 and earlier, while native.encoding based on the OS locale is applied for JDK 18 and later, so that existing behavior is maintained across all JDK environments. |
| Occurrence Date | 26.08.10. |
| Version Requiring the Patch | 7FS02PS |
Patch Information
| Patch Name | FS02PS_701255a |
| Major Version | 7 |
| Minor Version | FS02PS |
| Version Title | Character Data Corruption When Updating ResultSet/RowSet in JDK 18+ (JEP 400) Environments |
| Available for Distribution | 26.11.11. |
| Compatibility | • TAC rolling patch: Yes • TSC rolling patch: Yes • Backup data compatibility: Yes • Protocol compatibility: Yes • Data format compatibility: Yes |
| Application Impact | • Plan change required: No • Result value changes: Yes • SQL syntax changes: No • System object changes: No • Existing functionality changes: No |
| Parameter | - |
| Workaround | 1) In JDK 18 and later environments, specifying the JVM option -Dfile.encoding=COMPAT restores the default encoding based on the OS locale and makes the system operate the same as JDK 17 and earlier, allowing you to avoid character data corruption (replacement with U+FFFD) caused by the JVM upgrade. - This option is valid only in JDK 18 and later. - Do not directly specify a specific encoding value such as MS949, because operation is not guaranteed in JDK 18 and later. 2) Alternatively, avoid using the affected-path APIs: use PreparedStatement setString()/setBytes() bindings and regular query paths instead of Updatable ResultSet updateBytes() (character columns)/updateString() (RAW columns) and the CachedRowSet family to avoid the impact of this defect (the regular paths have been confirmed to behave identically regardless of the JVM version). However, the above workaround is a temporary measure that only prevents new symptoms caused by the JVM upgrade; the defect itself (behavior in which stored/returned values vary depending on the locale of the execution environment, and byte-length amplification when RAW values are stored repeatedly) remains until the patch is applied. |