问题
I am a fan of H2, and H2-Console. Unfortunatly, when i run the h2 on my java spring-boot application, by default the JDBC URL is as jdbc:h2:~/test
meanwhile it should be jdbc:h2:mem:testdb to be able to see the saved objects.
So, I am wondering if there is a way to configure this JDBC URL from the application.properties or not?
The below image shows better what i am talking about:
回答1:
You can use below properties for connecting h2 database via application.properties file
spring.h2.console.enabled=true
spring.h2.console.path=/h2
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver
来源:https://stackoverflow.com/questions/46503219/how-to-set-h2-jdbc-from-application-properties-file