The H2 in memory database is very convenient for development because your evolutions are run from scratch when play is restarted. If you are using anorm you probably need it to closely mimic your planned production database. To tell h2 that you want to mimic a particular database you add a parameter to the database url in your application.conf file, for example:
§Prevent in memory DB reset
H2, by default, drops your in memory database if there are no connections to it anymore. You probably don’t want this to happen. To prevent this add
DB_CLOSE_DELAY=-1 to the url (use a semicolon as a separator) eg:
H2, by default, creates tables with upper case names. Sometimes you don’t want this to happen, for example when using H2 with Play evolutions in some compatibility modes. To prevent this add
DATABASE_TO_UPPER=FALSE to the url (use a semicolon as a separator) eg:
You can browse the contents of your database by typing
h2-browser at the play console. An SQL browser will run in your web browser.
More H2 documentation is available from their web site
Found an error in this documentation? The source code for this page can be found here. After reading the documentation guidelines, please feel free to contribute a pull request. Have questions or advice to share? Go to our community forums to start a conversation with the community.