gpt4 book ai didi

database - 在哪里将 -ifNotExists 标志添加到 h2 启动命令?

转载 作者:搜寻专家 更新时间:2023-10-30 23:26:42 26 4
gpt4 key购买 nike

我正在关注这个问题。 I am getting error after opening the h2 database console, i enter database name but it is showing database not found errir

我也有同样的问题。用户@joelittlejohn 提供了答案,答案是添加标志-ifNotExists。但我不知道在哪里添加标志。我无法添加评论,因为它需要 50 分 我是新人 我没有 50 分。所以我必须在这里问一下。

我正在学习有关将 H2 与 spring boot 结合使用的教程。我应该在哪里将 -ifNotExists 标志添加到 h2 启动命令?它是添加到 application.properties 文件还是其他地方?

我也试过独立版。如何添加标志?我添加到 h2.bat 但这不起作用。我应该在哪里添加它?

@java -cp -ifNotExists "h2-1.4.199.jar;%H2DRIVERS%;%CLASSPATH%" org.h2.tools.Console%*
@if errorlevel 1 pause

最佳答案

-ifNotExistsServer 的命令行参数工具。 Console 不支持该选项.您应该像这样更改 bat 文件:

@java -cp "h2-1.4.199.jar;%H2DRIVERS%;%CLASSPATH%" org.h2.tools.Server -ifNotExists 

要使用 Spring Boot 在服务器模式下启动 H2,请参阅这篇文章 How to enable H2 Database Server Mode in Spring Boot .您可以像这样传递选项:

public Server h2Server() throws SQLException {
return Server.createTcpServer("-ifNotExists", "-tcpAllowOthers", ...);
}

您仍然可以在嵌入式模式下运行 H2,在这种情况下应该默认创建数据库。

关于database - 在哪里将 -ifNotExists 标志添加到 h2 启动命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56231401/

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