I'm trying to persist a H2 in-memory DB into a file with spring boot to reuse the data in there.
Unfortunatly, the way to specify the datasource url like
spring.datasource.url = jdbc:h2:file:~/WeatherDB;FILE_LOCK=FS
(complete application.properties)
doesnt work for me. I can't find a file generated by H2 anywhere on my harddisk (also, save data is not available after restarting the server).
To visualize this, I create a sample project that can be found on bitbucket: http://ift.tt/1BgDbf9
With that, it doesn't seem to make a difference if the application is run from an IDE with gradle run
or after packaging it from the jar.
What config option is needed to persist and reuse the H2 DB ?
Update:
I realized there is a actuator endpoint for config options at http://localhost:8080/configprops
that shows
"spring.datasource.CONFIGURATION_PROPERTIES": {
"prefix": "spring.datasource",
"properties": {
"schema": null,
"data": null,
"xa": {
"dataSourceClassName": null,
"properties": { }
},
"separator": ";",
"url": "jdbc:h2:file:~/WeatherDB",
"platform": "all",
"continueOnError": false,
"jndiName": null,
"sqlScriptEncoding": null,
"password": "******",
"driverClassName": "org.h2.Driver",
"initialize": true,
"username": "sa"
}
},
But I just can't find an file WeatherDB
on my harddisk nor is any data available after restarting the server.
Any suggestions very much welcome ;-)
Aucun commentaire:
Enregistrer un commentaire