Question

I'd like to use ANORM to connect to db in play console, just simply test some stuff. But there's some errors when I create a DataSource

val ds=DB.getDataSource()
java.lang.RuntimeException: There is no started application
Was it helpful?

Solution

You can start an application from within the play console:

[My application] $ console
scala> import play.core.StaticApplication
import play.core.StaticApplication

scala> new StaticApplication(new java.io.File("."))
[info] play - Application started (Prod)
res0: play.core.StaticApplication = play.core.StaticApplication@...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top