9

我正在使用 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); 
}

代码工作正常,直到

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

但是一旦执行到

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

系统抛出异常

[jcc][10120][11936][4.3.111] 无效操作:Lob 已关闭。错误代码=-4470,SQLSTATE=null

我做错了什么?

如何解决这个问题?

4

2 回答 2

17

可以通过向progressiveStreaming=2;连接 url 添加参数来解决此问题

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

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

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

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

最好使用db2jcc4.jar

于 2014-03-31T11:09:54.327 回答
-1
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

它对我有用..

于 2018-07-16T13:25:47.657 回答