gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 02:54:29 29 4
gpt4 key购买 nike

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

enter image description here

更新信息:-

应用程序属性:-

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

主类:-

@SpringBootApplication
public class DemoApplication {

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

}

最佳答案

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

关于java - 为什么 H2 数据库不在浏览器中显示我的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61797029/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com