1.驱动问题,确保连接Oracle的驱动版本保持比较新的版本
2.你在使用PreparedStatement的时候绑定类型错误。使用setString 时小于4000字符是没问题,但是超过4000就必须用setClob才行。所以有一种可能就是你在测试环境时数据小于4000就没问题,然后再用户使用环境可能超过4000所以就出错了。
如果想了解更多数据库知识可以关注我的公众号:唯一的小彬哥
下面是我自己封装的绑定变量的代码片段,CLOB部分的代码片段。你可以参考一下
case DataType.LONG:
pstmt.setLong(j + 1, Long.parseLong(config.getBindValue(j)));
break;
case DataType.CLOB:
if (config.getBindValue(j) == null || config.getBindValue(j).trim().length() == 0) {
pstmt.setString(j + 1, config.getBindValue(j));
} else {
StringReader reader = new StringReader(config.getBindValue(j));
pstmt.setClob(j + 1, reader, config.getBindValue(j).length());
}
break;