0

I'm writing an app using slick and h2 in-memory db. I'd like to check how my data is written to db by creating database config in IntelliJ idea, but all the tables are missing.


Here is my code:

application.conf

h2mem = {
  url = "jdbc:h2:mem:testdb;MODE=MYSQL;DB_CLOSE_DELAY=-1"
  driver = org.h2.Driver
  connectionPool = disabled
}

Repository.scala

....
class TaskTable(tag: Tag) extends Table[Task](tag, "TASK") {
    def id = column[Long]("ID", O.PrimaryKey, O.AutoInc)

    def startTime = column[LocalTime]("START_TIME")

    override def * = (id.?, startTime) <> (Task.tupled, Task.unapply)
}
....

Main.scala

....
 val db = Database.forConfig("h2mem")
 val repo= new Repo(H2Profile)
 db.run(repo.createTaskTable)
 ...

And Idea config: enter image description here

Naya
  • 850
  • 6
  • 19

1 Answers1

0

Multiple connections to a named in-memory h2 database are allowed only from the same virtual machine. You must start a TCP server in order to be able to connect via IntelliJ IDEA.

More about in-memory connection here
More about connection modes here

Feedforward
  • 4,521
  • 4
  • 22
  • 34