使用 play framework v1.5 连接 db postgresql 时出错
Error when connected db postgresql with play framework v1.5
我正在使用 play framework v1.5,在我的 "application.conf" 文件中使用以下参数配置数据库:
db.url=jdbc:postgresql:test
db.driver=org.postgresql.Driver
db.user=test
db.pass=123
连接db postgresql,但是当我启动项目时抛出这个错误
错误
A database error occurred : Cannot connected to the database[default], Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
记录错误
@77f2flm68
Internal Server Error (500) for request GET /
Database error
A database error occurred : Cannot connected to the database[default], Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
play.exceptions.DatabaseException: Cannot connected to the database[default], Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
at play.db.DBPlugin.onApplicationStart(DBPlugin.java:118)
at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:600)
at play.Play.start(Play.java:549)
at play.Play.detectChanges(Play.java:672)
at play.Invoker$Invocation.init(Invoker.java:220)
at Invocation.HTTP Request(Play!)
Caused by: org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:753)
at org.postgresql.jdbc4.AbstractJdbc4Connection.isValid(AbstractJdbc4Connection.java:109)
at org.postgresql.jdbc4.Jdbc4Connection.isValid(Jdbc4Connection.java:21)
at com.zaxxer.hikari.pool.PoolBase.checkDriverSupport(PoolBase.java:434)
at com.zaxxer.hikari.pool.PoolBase.setupConnection(PoolBase.java:405)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:363)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:443)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:514)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:111)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:97)
at play.db.DBPlugin.testDataSource(DBPlugin.java:124)
at play.db.DBPlugin.onApplicationStart(DBPlugin.java:106)
... 5 more
我尝试将 jdbc 更新到最新版本,但错误仍然存在。
dependencies.yml 文件
# Application dependencies
require:
- play
- play -> docviewer
- play -> secure
- org.postgresql -> postgresql 42.2.2
执行后的日志"play deps"
_ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.5.0, https://www.playframework.com
~
~ Resolving dependencies using /home/navastud/eclipse-workspace /initialtemplate/conf/dependencies.yml,
~
~
~ Some dependencies have been evicted,
~
~ postgresql 42.2.2 is overridden by postgresql 9.0
~
~ Installing resolved dependencies,
~
~ modules/docviewer -> /home/navastud/play-1.5.0/modules/docviewer
~ modules/secure -> /home/navastud/play-1.5.0/modules/secure
~
~ Done!
如何解决连接postgresql数据库的问题?
我在google组找到了解决方案playone
缺少在依赖文件中添加 "force: true"
dependencies.yml 文件
# Application dependencies
require:
- play
- play -> docviewer
- play -> secure
- org.postgresql -> postgresql 42.2.2:
force: true
我正在使用 play framework v1.5,在我的 "application.conf" 文件中使用以下参数配置数据库:
db.url=jdbc:postgresql:test
db.driver=org.postgresql.Driver
db.user=test
db.pass=123
连接db postgresql,但是当我启动项目时抛出这个错误
错误
A database error occurred : Cannot connected to the database[default], Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
记录错误
@77f2flm68
Internal Server Error (500) for request GET /
Database error
A database error occurred : Cannot connected to the database[default], Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
play.exceptions.DatabaseException: Cannot connected to the database[default], Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
at play.db.DBPlugin.onApplicationStart(DBPlugin.java:118)
at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:600)
at play.Play.start(Play.java:549)
at play.Play.detectChanges(Play.java:672)
at play.Invoker$Invocation.init(Invoker.java:220)
at Invocation.HTTP Request(Play!)
Caused by: org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:753)
at org.postgresql.jdbc4.AbstractJdbc4Connection.isValid(AbstractJdbc4Connection.java:109)
at org.postgresql.jdbc4.Jdbc4Connection.isValid(Jdbc4Connection.java:21)
at com.zaxxer.hikari.pool.PoolBase.checkDriverSupport(PoolBase.java:434)
at com.zaxxer.hikari.pool.PoolBase.setupConnection(PoolBase.java:405)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:363)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:443)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:514)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:111)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:97)
at play.db.DBPlugin.testDataSource(DBPlugin.java:124)
at play.db.DBPlugin.onApplicationStart(DBPlugin.java:106)
... 5 more
我尝试将 jdbc 更新到最新版本,但错误仍然存在。
dependencies.yml 文件
# Application dependencies
require:
- play
- play -> docviewer
- play -> secure
- org.postgresql -> postgresql 42.2.2
执行后的日志"play deps"
_ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.5.0, https://www.playframework.com
~
~ Resolving dependencies using /home/navastud/eclipse-workspace /initialtemplate/conf/dependencies.yml,
~
~
~ Some dependencies have been evicted,
~
~ postgresql 42.2.2 is overridden by postgresql 9.0
~
~ Installing resolved dependencies,
~
~ modules/docviewer -> /home/navastud/play-1.5.0/modules/docviewer
~ modules/secure -> /home/navastud/play-1.5.0/modules/secure
~
~ Done!
如何解决连接postgresql数据库的问题?
我在google组找到了解决方案playone
缺少在依赖文件中添加 "force: true"
dependencies.yml 文件
# Application dependencies
require:
- play
- play -> docviewer
- play -> secure
- org.postgresql -> postgresql 42.2.2:
force: true