I'm trying to connect a sqlite database with Slick 3.1.1, using Macroid for Scala in Android develop.
Here is my code:
lazy val db = Database.forURL(
url = "jdbc:sqlite:" + getApplicationContext().getFilesDir() + "events.txt",
driver = "org.sqlite.JDBC")
dbSetupAction()
The dbSetupAction:
def dbSetupAction() = {
val initActions = DBIO.seq(
events.schema.create
)
val futureInitActions = db.run(initActions)
futureInitActions.onComplete {
case Success(s) => Log.d("FICHEROS Success", s.toString)
case Failure(ex) => Log.d("FICHEROS Failure", ex.toString)
}
}
Event class:
class Events(tag: Tag) extends Table[(Int, Int, Double)](tag, "EVENTS"){
def id = column[Int]("ID", O.PrimaryKey, O.AutoInc)
def eventType = column[Int]("EVENT_TYPE")
def timeTag = column[Double]("TIMETAG")
def * = (id, eventType, timeTag)
}
The output error i got is:
D/FICHEROS Failureļ¹ java.lang.ClassNotFoundException: org.sqlite.JDBC
In my build.sbt, i've added:
libraryDependencies ++= Seq(
aar("org.macroid" %% "macroid" % "2.0.0-M4"),
aar("com.android.support" % "support-v4" % "21.0.0"),
"org.xerial" % "sqlite-jdbc" % "3.8.11.2",
"com.typesafe.slick" %% "slick" % "3.1.1",
"org.slf4j" % "slf4j-nop" % "1.6.4")
Thanks in advance.