用户缺少权限或找不到对象:<TABLE>

问题描述

我正在尝试使用如下存储过程在 Spring Boot 嵌入式 HsqlDB 中填充数据。

schema.sql 文件内容

CREATE TABLE COUNTRY
(NAME CHAR(6) NOT NULL,ID INT NOT NULL,PRIMARY KEY (ID));

CREATE PROCEDURE ACC_DETAILS(OUT newid INT,IN firstname VARCHAR(50))
    MODIFIES sql DATA
BEGIN ATOMIC
DECLARE temp_id INTEGER;
INSERT INTO COUNTRY VALUES (firstname,1);
SET newid = temp_id;
END

即使表 COUNTRY 创建语句在那里,我也得到异常说

nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method Failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute sql script statement #1 of URL [file:/C:/Dev/code/Portfolio-service/portfolio-service/target/test-classes/schema.sql]: CREATE TABLE COUNTRY (NAME CHAR(6) NOT NULL,PRIMARY KEY (ID)); CREATE PROCEDURE ACC_DETAILS(OUT newid INT,IN firstname VARCHAR(50)) MODIFIES sql DATA BEGIN ATOMIC DECLARE temp_id INTEGER; INSERT INTO COUNTRY VALUES (firstname,1); SET newid = temp_id; END ; nested exception is java.sql.sqlSyntaxErrorException: user lacks privilege or object not found: COUNTRY
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769)

尝试了this question中提到的步骤,但没有成功

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)