dbcp 连接 postgresql 报org.postgresql.jdbc4.Jdbc4Statement.setQueryTimeout(int)

Caused by: org.postgresql.util.PSQLException: 这个 org.postgresql.jdbc4.Jdbc4Statement.setQueryTimeout(int) 方法尚未被实作。
at org.postgresql.Driver.notImplemented(Driver.java:753)
at org.postgresql.jdbc2.AbstractJdbc2Statement.setQueryTimeout(AbstractJdbc2Statement.java:656)
at org.apache.commons.dbcp.DelegatingStatement.setQueryTimeout(DelegatingStatement.java:249)
at org.apache.commons.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:656)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1558)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)

... 59 more


查看org.postgresql.jdbc2.AbstractJdbc2Statement.setQueryTimeout发现seconds设置问题

 public void setQueryTimeout(int seconds) throws SQLException
    {
        checkClosed();
        if (seconds < 0)
            throw new PSQLException(GT.tr("Query timeout must be a value greater than or equals to 0."),
                                    PSQLState.INVALID_PARAMETER_VALUE);


        if (seconds > 0)
            throw Driver.notImplemented(this.getClass(), "setQueryTimeout(int)");


        timeout = seconds;
    }


解决办法是去除配置文件配置项

<property name="validationQueryTimeout">
<value>1</value>
</property>


©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页