我連接到 h2 資料庫,并在使用郵遞員時發布物體。但是每次重新運行我的代碼時,我都會丟失資料。
spring.h2.console.enabled=true
spring.datasource.url = jdbc:h2:mem:crm/db_;DB_CLOSE_DELAY=-1
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
無論如何要在 H2Database 中存盤資料嗎?
uj5u.com熱心網友回復:
您的資料源 url 將其指定為記憶體資料庫 (h2:mem)。您可以指定它以將資料存盤在檔案中(以嵌入模式) - 請參閱http://www.h2database.com/html/cheatSheet.html。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/454151.html
