1

I am using play framework v1.5, configure the database with the following parameters in my "application.conf" file:

db.url=jdbc:postgresql:test
db.driver=org.postgresql.Driver
db.user=test
db.pass=123

to connect db postgresql, but when I start the project throws this error

Error

 A database error occurred : Cannot connected to the database[default], Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented. 

Logs Error

@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

I tried to update the jdbc to the latest version but still the error persists.

dependencies.yml file

# Application dependencies

require:
    - play
    - play -> docviewer
    - play -> secure
    - org.postgresql -> postgresql 42.2.2

Logs after execute "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!

How to solve this problem to connect postgresql database?

6
  • "postgresql 42.2.1 is overridden by postgresql 9.0" would indicate your driver is overridden with a very old version. Not sure how play handles that though. Commented Apr 2, 2018 at 14:59
  • supposedly I should replace the jdbc driver of postgresql with the one indicated in the dependencies file, but I do not know if that has relevance in the error Commented Apr 2, 2018 at 15:09
  • The error is very relevant, because the PostgreSQL JDBC 9.0 driver is ancient and does not implement isValid(int). Commented Apr 2, 2018 at 15:14
  • ok, but the error is thrown before the jdbc driver was updated Commented Apr 2, 2018 at 15:42
  • 1
    I'll rephrase: you think you're using PostgreSQL JDBC driver 42.2.2, but you are not, you're apparently using version 9.0. Commented Apr 2, 2018 at 16:08

1 Answer 1

2

I found the solution in the google group playone

which was missing adding the "force: true" in the dependencies file

dependencies.yml file

# Application dependencies

require:
    - play
    - play -> docviewer
    - play -> secure
    - org.postgresql -> postgresql 42.2.2:
       force: true
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.