【发布时间】:2018-08-26 13:33:26
【问题描述】:
我想启动一个 h2 数据库服务器并将多个 java 应用程序连接到它。为了做到这一点,我使用以下命令启动了一个 h2 服务器(版本 1.4.196)
java -cp h2-1.4.196.jar org.h2.tools.Server -tcp -web
我看到上述命令的以下输出
TCP server running at tcp://10.234.4.136:9092 (only local connections)
Web Console server running at http://10.234.4.136:8082 (only local connections)
然后我用下面的 application.properties 启动一个 spring boot 应用程序
server.port=9090
spring.datasource.url=jdbc:h2:tcp://10.234.4.136:9092/~/AZ
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=create
java代码是
@SpringBootApplication
public class Application {
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class)
.properties("spring.config.name:application")
.build()
.run(args);
}
}
spring boot(1.3.6 版)应用程序启动,但在架构导出步骤中卡住,并显示以下日志
2018-03-17 20:38:46.290 WARN 17260 --- [ost-startStop-1] o.h.e.jdbc.internal.JdbcServicesImpl : HHH000341: Could not obtain connection metadata : Connection is broken: "unexpected status 16843008" [90067-192]
2018-03-17 20:38:46.291 INFO 17260 --- [ost-startStop-1] o.h.e.jdbc.internal.LobCreatorBuilder : HHH000422: Disabling contextual LOB creation as connection was null
2018-03-17 20:38:46.348 INFO 17260 --- [ost-startStop-1] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2018-03-17 20:38:46.496 INFO 17260 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
我想启动多个连接到同一个 h2 数据库服务器的 java 应用程序,但第一个应用程序卡住了,如上所述。
【问题讨论】:
-
我不明白这是如何与另一个问题重复的。我既没有使用其他问题所述的相同配置选项启动服务器,也没有指定它们解决我上面提到的问题的答案。请在将其标记为重复之前分享更多详细信息。
标签: java spring-boot h2