Springboot+Mybatis+Postgresql遇到的问题

mvn install时遇到异常信息:

 

2018-07-09 16:47:52.127 ERROR 9784 --- [Druid-ConnectionPool-Create-611026433] com.alibaba.druid.pool.DruidDataSource   : create connection SQLException, url: jdbc:postgresql://localhost:5432/lark, errorCode 0, state 0A000

java.sql.SQLFeatureNotSupportedException: 这个 org.postgresql.jdbc4.Jdbc4Statement.setQueryTimeout(int) 方法尚未被实作。
    at org.postgresql.Driver.notImplemented(Driver.java:753) ~[postgresql-9.1-901-1.jdbc4.jar:na]
    at org.postgresql.jdbc2.AbstractJdbc2Statement.setQueryTimeout(AbstractJdbc2Statement.java:668) ~[postgresql-9.1-901-1.jdbc4.jar:na]
    at com.alibaba.druid.pool.vendor.PGValidConnectionChecker.isValidConnection(PGValidConnectionChecker.java:64) ~[druid-1.1.10.jar:1.1.10]
    at com.alibaba.druid.pool.DruidAbstractDataSource.validateConnection(DruidAbstractDataSource.java:1346) ~[druid-1.1.10.jar:1.1.10]
    at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1633) ~[druid-1.1.10.jar:1.1.10]
    at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2468) ~[druid-1.1.10.jar:1.1.10]

解决方法:在pom文件中修改postgresql9.3对应的依赖版本

<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.3-1102-jdbc41</version>
        </dependency>

我本地使用的是9.3版的postgresql,

下载对应的依赖:https://mvnrepository.com/artifact/org.postgresql/postgresql

posted @ 2018-07-09 18:07  liuyafen  阅读(6146)  评论(0编辑  收藏  举报