Java Lob 已关闭。ERRORCODE=-4470,SQLSTATE=null

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22659970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 17:09:10  来源:igfitidea点击:

Lob is closed. ERRORCODE=-4470, SQLSTATE=null

javajakarta-eedb2websphere-commerce

提问by Just_another_developer

I am using IBM websphere commerce and db2, have following piece of code

我正在使用 IBM websphere commerce 和 db2,有以下代码

Clob clobVar = null;
if (result.elementAt(3) != null)
    clobVar = (Clob) result.elementAt(3);

if (clobVar == null) {
    infoTable.put("EInfo", "");
} else {
    stringTemp = clobVar.getSubString(1, (int) clobVar.length());
    infoTable.put("EInfo", stringTemp); 
}

Code works fine till

代码工作正常,直到

clobVar = (Clob) result.elementAt(3);

but as soon as execution comes to

但一旦执行

stringTemp = clobVar.getSubString(1, (int) clobVar.length());

System throws an exception

系统抛出异常

[jcc][10120][11936][4.3.111] Invalid operation: Lob is closed. ERRORCODE=-4470, SQLSTATE=null

[jcc][10120][11936][4.3.111] 无效操作:Lob 关闭。ERRORCODE=-4470,SQLSTATE=null

What I am doing wrong?

我做错了什么?

How to resolve this issue?

如何解决这个问题?

回答by ashokramcse

This issue can be solved by adding progressiveStreaming=2;argument to the connection url

这个问题可以通过progressiveStreaming=2;在连接 url 中添加参数来解决

The fully specified Connection URL was to be given as below:

完全指定的连接 URL 如下所示:

jdbc:db2://localhost:50000/SAMPLE:progressiveStreaming=2;

Incase you have exception on that parameter add the following to it:

如果您对该参数有异常,请向其中添加以下内容:

jdbc:db2://localhost:50000/SAMPLE:driverType=4;fullyMaterializeLobData=true;fullyMaterializeInputStreams=true;progressiveStreaming=2;progresssiveLocators=2;

It is preferred to use db2jcc4.jar

最好使用 db2jcc4.jar

回答by vvg

If everything has worked earlier with same code...but the issue came up after db2 db change, then try below configuration..
db2set DB2_RESTRICT_DDF=TRUE

It worked for me..

它对我有用..