Reputation: 2277
Here is my postgres version postgresql/9.4.1
Here is my play version addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.6")
Here is my libraryDependencies
libraryDependencies ++= Seq(
jdbc,
cache,
ws,
specs2 % Test,
"postgresql" % "postgresql" % "9.1-901-1.jdbc4"
)
Changing version to 9.4-1201-jdbc41
gives sbt.ResolveException: unresolved dependency: postgresql#postgresql;9.4-1201-jdbc41: not found
Here is my application.conf
db.default.driver=org.postgresql.Driver
# I tried the following combination
#db.default.url="postgres://user:pass@localhost/20160210_scala_play"
# And
db.default.url="jdbc:postgresql://localhost/20160210_scala_play"
db.default.user="user"
db.default.password="pass"
All resulted in
`Cannot connect to database`
I verified that
psql \list
does contain
20160210_scala_play
with user=user password=password
Can someone point me a direction?
Upvotes: 4
Views: 4659
Reputation: 2826
Try
db.default.hikaricp.dataSourceClassName=org.postgresql.ds.PGSimpleDataSource
db.default.hikaricp.dataSource.user=user
db.default.hikaricp.dataSource.password=pass
db.default.hikaricp.dataSource.databaseName=20160210_scala_play
db.default.hikaricp.dataSource.serverName=localhost
and use this driver:
"org.postgresql" % "postgresql" % "9.4-1206-jdbc41"
Upvotes: 0
Reputation: 48193
By default, postgresql will listen to port 5432
. So, Unless you sure about the fact that your postgre instance is running on port 80
, change your JDBC url to:
jdbc:postgresql://localhost:5432/20160210_scala_play
And also, this dependency was resolved for me:
"org.postgresql" % "postgresql" % "9.4-1206-jdbc42"
Upvotes: 7