Spring Embedded数据库和存储过程的问题

时间:2013-02-20 09:08:05

标签: junit spring-jdbc

您好我有以下配置来运行基于Spring的测试用例:

<jdbc:embedded-database id="dataSource" type="HSQL">
<jdbc:script location="classpath:SQL1.sql"/>
    <jdbc:script location="classpath:SQL2.sql"/>
    <jdbc:script location="classpath:SQL3.sql"/>
    <jdbc:script location="classpath:StoredProcedure1.sql"/>
</jdbc:embedded-database>

其中SQL1,SQL2,SQL3包含简单的select和insert语句,但StoredProcedure1.sql是一个存储过程。当我运行测试用例时,不会创建数据源bean并给出以下错误。我确信我错过了一件简单的事情但却无法解决这个问题:

Caused by: java.sql.SQLSyntaxErrorException: unexpected token: OR
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.executeUpdate(Unknown Source)
at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.executeSqlScript(ResourceDatabasePopulator.java:184)
... 49 more

Caused by: org.hsqldb.HsqlException: unexpected token: OR at org.hsqldb.error.Error.parseError(Unknown Source) at org.hsqldb.ParserBase.unexpectedToken(Unknown Source) at org.hsqldb.ParserDDL.compileCreate(Unknown Source) at org.hsqldb.ParserCommand.compilePart(Unknown Source) at org.hsqldb.ParserCommand.compileStatements(Unknown Source) at org.hsqldb.Session.executeDirectStatement(Unknown Source) at org.hsqldb.Session.execute(Unknown Source) ... 52 more

请帮助,提前致谢。

1 个答案:

答案 0 :(得分:-1)

只是一个。

你可能有一个ALTER或CREATE PROCEDURE,HSQL上可能不允许这种语法?