mkovacek mkovacek - 4 months ago 51
SQL Question

Playframework 2.5.4. Cannot connect to database [db] (MySql)

I have created new play-scala app and I can't connect to mysql db.

Erorr:
Configuration error

Cannot connect to database [db]

c.z.h.HikariConfig - either dataSource or dataSourceClassName is required, more details here



To the same db with the same config I can connect with play 2.2.3

build.sbt


application.conf

Answer

You are using db.db.default.* instead of db.default.*.

In your config:

db {
  db.default.driver=com.mysql.jdbc.Driver
  db.default.url="jdbc:mysql://localhost:3306/sc_cvs"
  # (...)
}

Correct:

db {
  default.driver=com.mysql.jdbc.Driver
  default.url="jdbc:mysql://localhost:3306/sc_cvs"
  # (...)
}