H2控制台在H2数据库中抛出webAllowOthers错误

问题描述 投票:6回答:1

当我尝试使用heroku加载我的h2控制台时,我正在使用heroku部署我的应用程序,它正在抛出一个错误说。

H2控制台很抱歉,此服务器上禁用了远程连接('webAllowOthers')。

我在application.properties文件中使用以下设置

jdbc:h2:tcp://localhost/~/test
spring.datasource.platform=h2
spring.datasource.url=jdbc:h2:mem:Roomy;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled = true 
spring.h2.console.settings.trace=true 
spring.h2.console.settings.web-allow-others=true

我做了一些谷歌并添加了.h2.server.properties

#H2 Server Properties
1=Generic H2 (Memory)|org.h2.Driver|jdbc:h2:mem:Roomy;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE|sa
webAllowOthers=true
tcpAllowOthers=true
webPort=8082
webSSL=false

请提一下我做错了什么,我无法查看h2控制台可以有人帮忙。这个cosole工作正常在本地和heroku数据库工作没有问题,但无法查看控制台。任何帮助会非常感激的。

谢谢Chaitanya

java spring-boot spring-data spring-data-jpa h2
1个回答
13
投票

application.properties中,添加以下设置。

spring.h2.console.settings.web-allow-others=true

在我的情况下,它的工作原理。


0
投票

某些云服务不允许该连接,安全限制。

© www.soinside.com 2019 - 2024. All rights reserved.