Logister
Logister

Reputation: 1904

Play 2 postgres driver not found

I'm doing a Scala Play 2 project in IntelliJ, and for some reason, the play framework wont recognize the Postgres driver.

Configuration error[Cannot connect to database [default]]
Caused by: play.api.Configuration$$anon$1: Configuration error[Driver not found: [org.postgresql.jdbc.Driver}]]

My build.sbt is updated:

libraryDependencies += "org.postgresql" % "postgresql" % "9.4-1206-jdbc42"

My application.conf has all the right stuff:

db.default.driver="org.postgresql.jdbc.Driver"
db.default.url="jdbc:postgresql://theurl:5439/mydb"
db.default.user="me"
db.default.password="thepassword"

Note that I have verified the username, password, and connection url separately - they work.

Things I have tried: (1) downloading the divers manually and putting them in my lib directory, (2) restarting/rebuilding the project, (3) changing the driver versions, and (4) implementing the solution for a similar problem here which involved adding the following line to my application.conf:

db.default.hikaricp.connectionTestQuery = "SELECT 1"

None of these things have worked, or even changed the error message. How can I fix this?

Upvotes: 0

Views: 680

Answers (1)

Nader Ghanbari
Nader Ghanbari

Reputation: 4300

The driver you provided ("org.postgresql.jdbc.Driver") is incorrect. The correct one is org.postgresql.Driver.

Details

According to the Play Docs here you need the following configuration:

# application.conf
db.default.driver=org.postgresql.Driver
db.default.url="....."

Upvotes: 1

Related Questions