Reputation: 6289
I am using the default database in a Play 2 application:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
I thought this database was supposed to be in-memory and that the data would disappear in between runs of the application, but the data seems to persist somewhere even after I shut off the app.
Where is the data being persisted and how can I clean out the database?
Upvotes: 2
Views: 849
Reputation: 1255
In response to your comment, Ctrl-D in the console doesn't terminate the Play application; it runs the application in the background and makes the console available again (that's why closing the console didn't terminate the application). I'm not sure about non-Linux operating systems, but in Linux, you need to use ctrl-C in the console or kill <pid>
in another console to terminate the Play application.
Upvotes: 1
Reputation: 822
accoding to h2 site:
By default, closing the last connection to a database closes the database. For an in-memory database, this means the content is lost. To keep the database open, add ;DB_CLOSE_DELAY=-1 to the database URL. To keep the content of an in-memory database as long as the virtual machine is alive, use jdbc:h2:mem:test;DB_CLOSE_DELAY=-1.
this may there is more than one connection to your database.
Upvotes: 0