Last active
December 20, 2015 21:29
-
-
Save lanceon/6197983 to your computer and use it in GitHub Desktop.
Lift + MySQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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