How to connect to h2 browser with the Play Framework Application Run/Debug Configuration

Answered

How do I connect to the h2 browser for the in memory database when I run or debug my Play app from the Run/Debug configuration tool?

4 comments
Comment actions Permalink

See http://www.h2database.com/html/features.html#in_memory_databases. If you want to create a Data Source for the in-memory database that your application uses, you need to start tcp server in your application on some tcp port and use this port when creating new H2 Data Source in IDE:

0
Comment actions Permalink

When I try this my application cannot connect to the database on start up.

 

 

I have what you have only I've changed "default" to "play"

0
Comment actions Permalink

I was able to get the url "jdbc:h2:tcp://localhost/mem:play" to work but only after starting the "h2-console" from the command line.  Which again begs the question, how do I start the h2-console from the idea play run/debug configuration?

 

Here's a look with the default settings.

 

0
Comment actions Permalink

How do you start h2 console?

Have you started the tcp server in your Play 2 application so that you could connect to the database over tcp from another process? Like described here: https://stackoverflow.com/a/44726304/2000323. After this you should be able to connect from IDE data source via the url like you've mentioned.

0

Please sign in to leave a comment.