標籤:tis depend time pom pen java exception support postgres
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 0A000java.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
Springboot+Mybatis+Postgresql遇到的問題