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

来源:互联网 发布:md5加密java代码 密钥 编辑:程序博客网 时间:2024/06/06 08:27
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>


0 0
原创粉丝点击