Search code examples
playframeworkplayframework-1.x

Postgresql with Play Framework


Im trying to use Postgresql with Play for their Yabe tutorial and get this error:

Cannot connected to the database, Driver not found (org.postgresql.Driver)

Here is my connection string:

# If you need a full JDBC configuration use the following :
 db.url=jdbc:postgresql:yabe
 db.driver=org.postgresql.Driver  
 db.user=yabe
 db.pass=yabe
#
# Connections pool configuration :
 db.pool.timeout=1000
 db.pool.maxSize=30
 db.pool.minSize=1

In my lib folder I have this: postgresql-9.1-901.jdbc3.jar

I tried changing the driver name to the same name is tha jar but still get the same error. Any ideas?


Solution

  • The Play framework already includes the driver for Postgres. do the following:

    • Remove any reference to postgreSQL drivers from your dependencies.yml files
    • Do a "play deps --sync"
    • Remove any jar in your lib/ folder related to postgreSQL drivers
    • Change your connection string to:

      db=postgres://user:pwd@localhost:5432/yabe

    This should solve the conflict you have.