How to enable H2 Database Server Mode in Spring Boot

user1119859 :

I'm using a H2 database with a file using Spring Boot.

In my application.properties, I have this entry:

spring.datasource.url=jdbc:h2:file:c:/Testprojekte/spring-boot-h2-db

But now I would like to be able to look at the database while running the application, which currently isn't possible because I need to have the database running in server mode in order to do so. In the documentation I found that I have to add AUTO_SERVER=TRUE to the URL but this doesn't solve the problem.

So, what do I have to change to be able to connect to that database from different processes at the same time ?

thanks for any help! Thorsten

Sma Ma :

You can enable h2 web console to access your h2 in memory or in file database using a web interface in your browser.

therefor add in application.properties the lines:

spring.h2.console.enabled=true
spring.h2.console.path=/h2-console

after that restart your spring boot application and check http://localhost:8080/h2-console with your browser.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=77131&siteId=1