Skip to content

Instantly share code, notes, and snippets.

@lanceon
Last active December 20, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lanceon/6197983 to your computer and use it in GitHub Desktop.
Save lanceon/6197983 to your computer and use it in GitHub Desktop.
Lift + MySQL
build.sbt
=========
libraryDependencies ++= {
val liftVersion = "2.5"
Seq(... "mysql" % "mysql-connector-java" % "5.1.26" ...)
}
default.props
=============
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://myhost/mydatabase
db.user=username
db.password=password
Boot.scala
==========
object DBVendor extends StandardDBVendor(
Props.get("db.driver", ""),
Props.get("db.url", ""),
Props.get("db.user"),
Props.get("db.password")
)
DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)
LiftRules.unloadHooks.append( () => DBVendor.closeAllConnections_!() )
S.addAround(DB.buildLoanWrapper())
Props.mode match {
case Props.RunModes.Development =>
val stables = Seq[BaseMetaMapper](...)
Schemifier.schemify(true, Schemifier.infoF _, DefaultConnectionIdentifier, stables: _*)
case _ =>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment