DB2JCC driver jar calling different jdk for character encoding conversion

528 views Asked by At

I have an application deployed on websphere console which connects with db2 database. The jdk installed is IBM JDK. On running a particular case from online screen, an error pops up :

UnsupportedEncodingException . ERRCODE = -4220

On checking the logs, below error seems to be the root cause.

Caused by: java.io.UnsupportedEncodingException: Cp037
at sun.io.Converters.getConverterClass(Converters.java:319)
at sun.io.Converters.newConverter(Converters.java:373)
at sun.io.ByteToCharConverter.getConverter(ByteToCharConverter.java:98)
at com.ibm.db2.jcc.am.r.<init>(r.java:10)

Analysis : Looks like the IBM db2 driver - db2jcc4.jar calls the underlying JDK's specific character encoding/decoding jar (charsets.jar i believe) to pass on the stream of buffer which would then be consumed by this jar and decoded into String format.

But as the above logs suggest, the library which gets called is of oracle jdk. The ByteToCharConverter class is in rt.jar of oracle jdk library. We are using IBM jdk which comes embedded in IBM's websphere server installation. Also the JAVA_HOME path on OS is set for IBM JDK only, and in websphere console , under the environment variables, JAVA_HOME is set as the root path of IBM JDK within the websphere server.

Do i need to set any particular parameter in websphere console, to tell how the encoding should happen.? Not sure how to come through this. Any help is appreciated.

Edit :

db2jcc version

IBM Data Server Driver for JDBC and SQLJ 4.18.60

java -version

java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 8.0.6.26 - pxa6480sr6fp26-20210216_01(SR6 FP26))
IBM J9 VM (build 2.9, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20210216_465732 (JIT enabled, AOT enabled)
OpenJ9   - e5f4f96
OMR      - 999051a
IBM      - 358762e)
JCL - 20210108_01 based on Oracle jdk8u281-b09
0

There are 0 answers