How to use a persistent H2 database in the Play Fr

2019-02-02 09:58发布

The H2 database used in the Java Todo List tutorial is the following:

db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"

How do I modify the configuration file to use a persistent database as opposed to an in-memory version. Do I need to setup an entirely separate DB or can I modify the db.default.url property?

I'm using Play! 2.0.3.

1条回答
冷血范
2楼-- · 2019-02-02 11:01

I found the solution.

To create a file database, modify the following:

From

db.default.url="jdbc:h2:mem:play"

To

db.default.url="jdbc:h2:file:data/db"

Where data/db is broken down into:

data/ The folder location of the database files relative to your project root.

db The name of your database files.

查看更多
登录 后发表回答