[英]Spring Boot - Show H2 Database Content
I have a Spring Boot Application with a H2 database.我有一个带有 H2 数据库的 Spring 引导应用程序。 I can add entries and I can see this entries on the swagger-ui website.
我可以添加条目,我可以在 swagger-ui 网站上看到这些条目。
But when I open the H2 console, I can not see the tables or the columns.但是当我打开 H2 控制台时,我看不到表格或列。
Is there a way to show me the content of the database?有没有办法向我展示数据库的内容? In a readable format?
以可读的格式?
My application.properties file:我的 application.properties 文件:
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感谢
The h2 console can be used to execute SQL queries so that you can view the content of the database. h2控制台可以用来执行SQL查询,以便查看数据库的内容。
You can execute for example SELECT * FROM YOUR_TABLE;
例如,您可以执行
SELECT * FROM YOUR_TABLE;
and you will see the result of the query in the console.您将在控制台中看到查询的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.