I'm trying to connect to a mysql database with slick 1.0.0.
What I've done so far:
in Build.scala I've added
val appDependencies = Seq(
anorm,
"mysql" % "mysql-connector-java" % "5.1.24",
"com.typesafe.slick" % "slick_2.10" % "1.0.0",
"org.slf4j" % "slf4j-nop" % "1.6.4"
)
in application.conf
db.default.driver=com.mysql.jdbc.Driver
db.default.url="url to mysql db"
db.default.user=user
db.default.pass=password
and now I'm trying to read an Entry from the DB. For this I have a model
package models
import scala.slick.driver.MySQLDriver.simple._
import Database.threadLocalSession
object Organisations extends Table[(Int, String)]("Organisation")
{
def id = column[Int]("id", O.PrimaryKey)
def name = column[String]("name")
def * = id ~ name
}
and now I'd like to just output the entries
val orgs =
for { o <- Organisations } yield o.name
println("Length" + orgs.toString())
But it doesn't work. I'm sure I've made plenty of errors, but there don't seem to be andy slick tutorials with mysql.
Thank you for your patience and I hope my explanations are clear.