connectionloggingproxy.wrap(conn)在oracle上导致“sqlexception:流已关闭”

lzfw57am  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(339)

使用jdbc运行以下查询时:

SELECT partition_name, high_value
FROM user_tab_partitions
WHERE table_name = 'SOME_TABLE_WITH_PARTITIONS';

尝试以下操作(在java中):

rs.getString("high_value");

产生以下错误:

java.sql.SQLException: Stream has already been closed
    at oracle.jdbc.driver.LongAccessor.getBytesInternal(LongAccessor.java:127)
    at oracle.jdbc.driver.Accessor.getBytes(Accessor.java:926)
    at oracle.jdbc.driver.LongAccessor.getString(LongAccessor.java:154)
    at oracle.jdbc.driver.GeneratedStatement.getString(GeneratedStatement.java:287)
    at oracle.jdbc.driver.GeneratedScrollableResultSet.getString(GeneratedScrollableResultSet.java:374)
    at oracle.jdbc.driver.GeneratedResultSet.getString(GeneratedResultSet.java:594)
    at com.zaxxer.hikari.pool.HikariProxyResultSet.getString(HikariProxyResultSet.java)
    at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jdbcdslog.ResultSetLoggingHandler.invoke(ResultSetLoggingHandler.java:19)
    at com.sun.proxy.$Proxy22.getString(Unknown Source)
    at mypackage.MyClass.extractHighValue(MyClass.java:46)
  • 请注意,这个问题与查询deprecated无关 LONG 类型。
3pmvbmvn

3pmvbmvn1#

显然,我们使用了一个连接 Package 器来记录名为(jdbcdslog)的查询:

ConnectionLoggingProxy.wrap(conn)

一旦我取下 Package ,一切都正常了,尽管我仍然不知道为什么 jdbcdslog 导致了这个问题。糟糕的反思?也许是与 hikaryCP ?

相关问题