[英]Unable to create embedded h2 database
I am using the web console of H2 Version 1.4.198 (2019-02-22) to create a embedded database. 我正在使用H2版本1.4.198(2019-02-22)的Web控制台创建嵌入式数据库。 But I am getting the following error saying "unable to find the database".
但是我收到以下错误,提示“无法找到数据库”。 I want to create the database not open an existing one.
我想创建数据库而不打开现有数据库。 I using ubuntu 18.04 and have given execute permisison to h2.jar and h2.sh.
我使用的是ubuntu 18.04,并为h2.jar和h2.sh提供了执行权限。
In application.properties or yaml file check spring.datasource.url remove the flag IFEXISTS=TRUE;. 在application.properties或yaml文件中,检查spring.datasource.url除去标志IFEXISTS = TRUE;。
If the flag is set to true, the connection is only established if the database exists. 如果该标志设置为true,则仅在数据库存在的情况下建立连接。 For reference of the flag see http://www.h2database.com/html/features.html#database_only_if_exists
有关该标志的参考,请参见http://www.h2database.com/html/features.html#database_only_if_exists
The application properties file should look like as below 应用程序属性文件应如下所示
application.properties application.properties
h2.datasource.driver-class-name=org.h2.Driver
h2.datasource.url=jdbc:h2:file:~/test;DB_CLOSE_ON_EXIT=TRUE;FILE_LOCK=NO
h2.datasource.username=sa
h2.datasource.password=
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console/
It looks like as below (Test Connection is successful) 如下图所示(测试连接成功)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.