DB Plugin is not registered in Play 2.0

PlexQ picture PlexQ · Mar 25, 2012 · Viewed 7.1k times · Source

I just started working with play, and I modified the way I'm doing a SQL read and I'm now getting the following error:

[Exception: DB plugin is not registered.]

The code I have for this class is:

package models

import play.api.db._
import play.api.Play.current

import anorm._

case class Housing(id: Long, rent: String, address: String, street0: String, street1: String, neighbourhood: String)

object Housing {

  def all(): List[Housing] = DB.withConnection { implicit c =>
    SQL("select * from housing")().map { row =>
      Housing(row[Long]("id"), row[String]("rent"), row[String]("address"), row[String]("street0"),
        row[String]("street1"), row[String]("neighbourhood"))
    }.toList
  }

  def create(rent: String, address: String, street0: String, street1: String, neighbourhood: String) {}

  def delete(id: Long) {}

}

I'm not sure this is even the best way to do this, but using the ~ chain seemed like I'd just end up duplicating a bunch of stuff.

Answer

PlexQ picture PlexQ · Mar 25, 2012

Turns out that somehow in the application.conf the line:

dbplugin=disabled

had arisen. Not sure, I know I didn't put it in there, but commenting it out and fixing the remaining config errors in the JDBC Url fixed the problem!