获取带有空SQL状态的错误代码4220

获取带有空SQL状态的错误代码4220

本文介绍了获取带有空SQL状态的错误代码4220的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误代码-4220与空SQL状态.SPXXXXX包含VARGRAPHICS数据类型。以下是完整的异常堆栈跟踪。 SP正确执行,读取输出参数即执行方法成功但是getString方法正在给出错误时出现错误。

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.

即使我正在尝试访问任何方法获取输出参数值,错误即将到来。只是FYI,我尝试使用最新版本的db2驱动程序,但仍然存在错误。

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


推荐答案

我使用最新版本的jar修复了问题并通过设置以下系统属性。

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

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

另一种方法是在DB2 SP中为char和varchar类型禁用unicode编码,这也适用于我。 。

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

这篇关于获取带有空SQL状态的错误代码4220的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 07:54