I am trying to connect to mysql database using slick 1.0.0.
What i have done so far:
in Build.scala I 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 a record from the database. 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 would just like to output the entries
val orgs = for { o <- Organisations } yield o.name println("Length" + orgs.toString())
But that will not work. I'm sure I got a lot of errors, but it seems there were no true slutorial tutorials with mysql.
Thank you for your patience, and I hope my explanations are clear.
source share