This should be super simple, by following the documentation by in play-2.0.0, but for some reason I'm unable to connect to the database.
The error given is that the database is not available. I have rechecked the username-password-database combination, and connected to
it through `psql`, so that is not the problem.
package models
import com.google.inject.Inject
import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfigProvider}
import play.db.NamedDatabase
import scala.concurrent.ExecutionContext.Implicits.global
import slick.driver.JdbcProfile
import models.{DJ => DJModel}
import scala.concurrent.Future
/**
* Created by deep on 10/16/16.
*/
class DJ_DAO @Inject()(@NamedDatabase("develop") protected val dbConfigProvider: DatabaseConfigProvider)
extends HasDatabaseConfigProvider[JdbcProfile] {
import driver.api._
private val DJs = TableQuery[DJTable]
private class DJTable(tag: Tag) extends Table[DJModel](tag, "DJ") {
def ID = column[Int]("ID", O.PrimaryKey, O.AutoInc)
def FirstName = column[String]("FIRST_NAME")
def LastName = column[String]("LAST_NAME")
def * = (ID, FirstName, LastName) <> (DJModel.tupled, DJModel.unapply)
}
// Methods for accessing / updating DB date
def insert(dj: DJModel): Future[Unit] = db.run(DJs += dj).map { _ => () }
}
Any suggestions?
Also, check screenshot for more info.