javapostgresqljdbcplayframework-1.x

Error when connected db postgresql with play framework v1.5


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?


Solution

  • 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