I am having some trouble accessing the mem database via the h2-browser
on a Play
framework project.
With the configuration below, that I think is the correct one (apparently not!) I am getting a h2-browser, but with no tables (beside schema, that is), even though I have applied some migrations.
What am I missing here? Thanks in advance.
conf/application.conf:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
db.default.user=sa
db.default.password=""
Connect to the embedded H2 database using the H2 console Alternatively you can connect using the browser based H2 console. The easiest way to access the console is to double click the H2 database jar file at <installation-directory>\confluence\WEB-INF\lib\h2-x.x.x.jar .
When you are using in-mem databases actually you are accessing two different databases (although with the same path). You have two solutions:
play
console)Unix (~
means your home directory)
db.default.url="jdbc:h2:tcp://localhost/~/some/path/to/MyPlayDB"
or Windows
db.default.url="jdbc:h2:tcp://localhost/c:/some/path/to/MyPlayDB"
Note that for best performance in production mode it's worthy switch back to embedded mode, however for dev stage that solution should be good enough (still faster than for an example MySQL)
To browse the contents of your database via the H2 Web Console, start both the web console and the Play application via the same Play console:
~/Projects/play-app $ activator
[play-app] $ h2-browser
[play-app] $ run
Play-App In-Memory Database
) to easily access them again later: org.h2.Driver
jdbc:h2:mem:play
sa
<blank>
Note that the above settings have to match your actual configuration (db.default.url
and so on).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With