Issue
I have a Spring Boot Application with a H2 database. I can add entries and I can see this entries on the swagger-ui website.
But when I open the H2 console, I can not see the tables or the columns.
Is there a way to show me the content of the database? In a readable format?
My application.properties file:
spring.datasource.url=jdbc:h2:mem:mooddb;
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=a
spring.datasource.password=a
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.sql.init.platform=h2
spring.jpa.hibernate.ddl-auto=create
spring.sql.init.data-locations=classpath:data-h2.sql
spring.h2.console.enabled=true
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.defer-datasource-initialization=true
spring.h2.console.path=/h2
spring.h2.console.settings.trace=false
spring.h2.console.settings.web-allow-others=false
Thank
Solution
The h2 console can be used to execute SQL queries so that you can view the content of the database.
You can execute for example SELECT * FROM YOUR_TABLE;
and you will see the result of the query in the console.
Answered By - Panagiotis Bougioukos