Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error code 4220 with null SQL State

I'm getting error code -4220 with null SQL State .the SP "XXXXX" contain VARGRAPHICS data type. Below is complete exception stack trace. SP is executing properly, the error is coming while reading output parameter i.e. execute method called successfully but getString method is giving error.

Even if I'm trying to access any method to get output parameter value, error is coming. Just FYI, I tried with latest version of db2 driver but still error persist.

    com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][3.65.77] Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
    at com.ibm.db2.jcc.am.cd.a(cd.java:682)
    at com.ibm.db2.jcc.am.cd.a(cd.java:60)
    at com.ibm.db2.jcc.am.cd.a(cd.java:112)
    at com.ibm.db2.jcc.am.gc.a(gc.java:2825)
    at com.ibm.db2.jcc.am.gc.a(gc.java:582)
    at com.ibm.db2.jcc.am.gc.q(gc.java:560)
    at com.ibm.db2.jcc.am.gc.N(gc.java:1557)
    at com.ibm.db2.jcc.am.gc.a(gc.java:1541)
    at com.ibm.db2.jcc.am.CallableStatement.D(CallableStatement.java:941)
    at com.ibm.db2.jcc.am.CallableStatement.getString(CallableStatement.java:920)
    at com.cst.test.daoLayer.SPTest.callDB2ProcOUTParameter(SPTest.java:118)
    at com.cst.test.daoLayer.SPTest.testLogic(SPTest.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:618)
    at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
    at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
    at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
    at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
    at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
    at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
    at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
    at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.nio.charset.MalformedInputException: Input length = 5
    at com.ibm.db2.jcc.am.r.a(r.java:19)
    at com.ibm.db2.jcc.am.gc.a(gc.java:2821)
    ... 28 more
Caused by: sun.io.MalformedInputException
    at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:278)
    at com.ibm.db2.jcc.am.r.a(r.java:16)
    ... 29 more
like image 444
Raj Avatar asked Jun 04 '13 05:06

Raj


2 Answers

I fixed the issue by using latest version of jar and by setting below system property .

System.setProperty("db2.jcc.charsetDecoderEncoder", "3");

Also another way is disable unicode encoding for char and varchar type in DB2 SP which also worked for me ..

like image 148
Raj Avatar answered Oct 13 '22 05:10

Raj


After experiencing this same error, it turned out that older versions of the db2jcc jar do not support Java 8. After reverting to Java 7, the error goes away. This can also be resolved by downloading the newer/supported version of the jar from IBM.

like image 37
kjkurtz Avatar answered Oct 13 '22 07:10

kjkurtz