import scala.slick.driver.PostgresDriver.simple._
import scala.slick.session.Database.threadLocalSession
object Main extends App {
Database.forURL("jdbc:postgresql://localhost:5432/slick", driver =
"org.postgresql.Driver",user="postgres",password="postgres") withSession { } ;
}
「withSession」パラメーターに何を入力すると思いますか。私はこちらの洗練されたチュートリアルに従おうとしていますが、postgres を使用しています。
ここに私のエラースタックがあります:
> run
[info] Running Main
[error] (run-main) java.sql.SQLException: No implicit session available; threadLocalSession can only be used within a withSession block
java.sql.SQLException: No implicit session available; threadLocalSession can only be used within a withSession block
at scala.slick.session.Database$.threadLocalSession(Database.scala:74)
at Main$delayedInit$body.apply(main.scala:9)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
at scala.App$class.main(App.scala:71)
at Main$.main(main.scala:4)
at Main.main(main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
[trace] Stack trace suppressed: run last compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 0 s, completed Sep 19, 2013 3:38:34 PM
ありがとう!