How to configure spring-boot to use file based H2 database

后端 未结 5 637
闹比i
闹比i 2020-12-23 10:51

I have successfully created a spring boot application that uses the H2 embedded database in-memory. I would now like to change this to a file based version that will persist

5条回答
  •  暖寄归人
    2020-12-23 11:34

    Create a file .h2.server.properties in your class path and put below things and try again. You can create this file in resources folder.

    #H2 Server Properties
    0=H2 File|org.h2.Driver|jdbc\:h2\:file\:~/test;DB_CLOSE_ON_EXIT=FALSE
    
    # Enable if you want other applications to connect
    #webAllowOthers=true
    #webPort=8082
    #webSSL=false
    

提交回复
热议问题