I am developing an application in Scala Play 2.5.4. I want to test my database interactions, and am attempting to do so by the method recommended in this page.
The trouble is, I am unable to import the object play.api.db.Databases. I suspect that I may need to add something to my build.sbt file, but since this is part of the Play API, I'm not so sure that this is the case.
There are some things available, but not what is shown in the API doc
Yes, you need to add in your
build.sbt
file this:After that, reload activator and update your dependencies (
activator update/sbt update
).Note that after this you will need also to add the jdbc driver of the database you intend to use. See more info in https://www.playframework.com/documentation/2.5.x/ScalaDatabase
Edit
As stated in the comments, this may cause problems with Slick. Unfortunately the classes you need to use are provided by that module, so if this causes you problems, you can try two things:
Databases
class code in https://github.com/playframework/playframework/blob/2.5.x/framework/src/play-jdbc/src/main/scala/play/api/db/Databases.scalaTry to disable the DBModule. I'm not quite sure about the syntax, so try each one of those: