We're developing a Play 2.4 application (Java API).
For dev purposes, we'd like to use a persistent H2 database with DB file path relative to the project root directory.
In How to use a persistent H2 database in the Play Framework instead of in-memory there was solution for Play 2.0:
db.default.url="jdbc:h2:file:data/db"
However, with Play 2.4 this doesn't seem to work but I get error message with the following exception at the bottom:
Caused by: org.h2.jdbc.JdbcSQLException: A file path that is implicitly
relative to the current working directory is not allowed in the database
URL "jdbc:h2:file:data/db". Use an absolute path, ~/name, ./name, or the
baseDir setting instead. [90011-187]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
...
I could get connection to work with an absolute path and with a path relative to the home directory, like the following:
db.default.url="jdbc:h2:file:/Users/foo/data/db"
or
db.default.url="jdbc:h2:~/data/db"
However, is there some way to refer to the project root folder?
db.default.url="jdbc:h2:./data/db"
? – Roman