繁体   English   中英

为什么 H2 数据库不在浏览器中显示我的表

[英]Why H2 database doesn't show my table in the browser

我知道 H2 是一个内存数据库,只要应用程序运行它就存在。 我正在关注本教程 它工作正常。 但是当我尝试在我的应用程序运行时在浏览器中检查我的表格时。 但它在那里没有显示任何东西。 怎么了? 如何在浏览器中查看我的表格?

在此处输入图像描述

更新信息:-

应用程序属性:-

spring.datasource.url=jdbc:h2:file:C:/temp/test
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

# Enabling H2 Console
spring.h2.console.enabled=true

# Custom H2 Console URL
spring.h2.console.path=/h2

spring.jpa.hibernate.ddl-auto=none

#Turn Statistics on and log SQL stmts
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.generate_statistics=false
#logging.level.org.hibernate.type=trace
#logging.level.org.hibernate.stat=debug

logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} - %msg%n

主class:-

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

}

您用于连接到 H2 数据库的连接字符串 ( jdbc:h2:~/testdb ) 似乎指向与连接字符串不同的数据库。 您需要更改 H2 控制台的连接字符串以匹配它。 单击断开连接按钮,它将带您进入连接表单。 在 JDBC URL 字段中输入您的连接字符串

请在属性文件中更正您的连接 URL,如下所示:

spring.datasource.url=jdbc:h2:mem:testdb

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM