我们正在开发一个Play 2.4应用程序(Java API)。
出于开发目的,我们想使用一个持久的H2数据库,其DB文件路径相对于项目根目录。
在如何在Play Framework中使用持久的H2数据库而不是内存中的中,提供了Play 2.0的解决方案:
db.default.url="jdbc:h2:file:data/db"
然而,在Play 2.4中,这似乎不起作用,但是我得到了以下底部异常的错误消息: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)
...
我可以通过绝对路径或相对于主目录的路径来建立连接,如下所示:
db.default.url="jdbc:h2:file:/Users/foo/data/db"
或者db.default.url="jdbc:h2:~/data/db"
然而,有没有一种方法可以引用项目的根文件夹?
db.default.url="jdbc:h2:./data/db"
的翻译是什么? - Roman