Answer the question
In order to leave comments, you need to log in
What is the problem of connecting the play.api.db package?
When creating a module for interacting with the database, an error of the following nature occurred:
object db is not a member of package play.api
package controllers
import javax.inject.Inject
import play.api.db.Database
import play.api.mvc._
class DBController @Inject()(db: Database, val controllerComponents: ControllerComponents)
extends BaseController{
def test() = Action{
var outString = "Content\n"
db.withConnection{conn =>
val rs = conn.createStatement().executeQuery("any query")
while (rs.next()){
outString += rs.getString("any params")
}
}
Ok(outString)
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question