How to use a persistent H2 database in the Play Framework instead of in-memory

前端 未结 1 669
野趣味
野趣味 2020-12-28 18: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\"

相关标签:
1条回答
  • 2020-12-28 19:20

    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.

    0 讨论(0)
提交回复
热议问题