1
votes

I've been trying to connect to a local postgres from Scala Play but for some reason can't seem to be able to import Database and NamedDatabase.

When trying to import with import play.api.db._ or import play.api.db.{ Database, NamedDatabase }, I receive a Can't resolve symbol db error. This literally makes 0 sense. I've tried re-importing the project and rebuilding in IntelliJ but it still won't work. Did something change with the db import that's undocumented? These import statements come directly from the Scala Play tutorial page:

https://www.playframework.com/documentation/2.5.x/ScalaDatabase

I've also included the postgres dependency in build.sbt but I think that's irrelevant:

"postgresql" % "postgresql" % "9.1-901.jdbc4",

Here's an image showing what's going on:

enter image description here

1

1 Answers

3
votes

Ah, I simply forgot to add a dependency:

libraryDependencies += jdbc

This fixed everything.