Reputation: 525
I am stuck in this, trying to change my h2 db from in memory to file based. But everytime on restart, it automatically connects to in memory.
Here is my application.properties
server.port=8010
spring.datasource.url=jdbc:h2:file:~/transactionsdb;AUTO_SERVER=TRUE
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=user
spring.datasource.password=password
#spring.sql.init.continue-on-error=true
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.show-sql=true
spring.h2.console.enabled=true
#spring.jpa.defer-datasource-initialization=true
spring.jpa.hibernate.ddl-auto=none
Please help me to progress. Thanks in advance
Upvotes: 0
Views: 1137
Reputation: 988
This is my application.yml file and on restart H2 database is connecting to the file database. I have created test1.mv.db file in /Users/rohit/ directory.
spring:
h2:
console:
enabled: true
datasource:
url: jdbc:h2:file:/Users/rohit/test1
username: sa
password:
data:
jpa:
repositories:
bootstrap-mode: default
In application start-up logs also I can see the same information
Upvotes: 1