hsql给出了执行此语句的异常

时间:2018-06-05 17:47:48

标签: sql spring hsqldb

我正在尝试使用内存hsql db运行我的Spring Cloud Task Batch Application的集成测试,它给出了执行此db语句的以下错误。此语句在sqlserver db中执行正常。我需要做一些语法更改吗?谢谢!

表格创建查询

CREATE TABLE TASK_SEQ (
    ID BIGINT NOT NULL,
    UNIQUE_KEY CHAR(1) NOT NULL,
    constraint UNIQUE_KEY_UN unique (UNIQUE_KEY)
);

插入查询

INSERT INTO TASK_SEQ (ID, UNIQUE_KEY) select * from (select 0 as ID, '0' as UNIQUE_KEY) as tmp;

错误Stacktrace

Caused by:

org.springframework.jdbc.datasource.init.ScriptStatementFailedException:
  Failed to execute SQL script statement #1 of class path resource
  [schema-DML.sql]: INSERT INTO TASK_SEQ (ID, UNIQUE_KEY) select * from
  (select 0 as ID, '0' as UNIQUE_KEY) as tmp; nested exception is
  java.sql.SQLSyntaxErrorException: unexpected token: )     at
  org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:491)

1 个答案:

答案 0 :(得分:0)

您需要在HSQLDB中启用SQL Server兼容性。请参阅指南:

http://hsqldb.org/doc/2.0/guide/compatibility-chapt.html#coc_compatibility_mssql

您的陈述看起来不必要地复杂。下面的内容应该适用于大多数数据库。

system("openssl enc -des3 -in HomeController.class -out cipher.des");