当我使用连接对象调用createClob方法时,如下所示
Clob clob = con.createClob();
Run Code Online (Sandbox Code Playgroud)
抛出以下异常.
Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:659)
at org.postgresql.jdbc.PgConnection.createClob(PgConnection.java:1246)
at org.apache.commons.dbcp2.DelegatingConnection.createClob(DelegatingConnection.java:868)
at org.apache.commons.dbcp2.DelegatingConnection.createClob(DelegatingConnection.java:868)
Run Code Online (Sandbox Code Playgroud)
我正在使用带有JDK8的数据库PostgreSQL 9.6.2并使用commons-dbcp2连接池,并在pom.xml中添加了以下Postgres依赖项
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
在类中createClob,createClob实现如下所示,它抛出了异常.
@Override
public Clob createClob() throws SQLException {
checkClosed();
throw org.postgresql.Driver.notImplemented(this.getClass(), "createClob()");
}
Run Code Online (Sandbox Code Playgroud)
解决此问题的解决方案或解决方法是什么?或者我们如何在Postgres查询中设置CLOB数据?