How to use HSQLDB in Oracle query syntax mode?

Posted by Jan Algermissen on Stack Overflow See other posts from Stack Overflow or by Jan Algermissen
Published on 2011-01-02T15:37:53Z Indexed on 2011/01/02 15:53 UTC
Read the original article Hit count: 280

Filed under:

I am trying to use HSQLDB as an embedded database in a spring application (for testing). As the target production database is Oracle, I would like to use HSQLDBs Oracle syntax mode feature.

In the Spring config I use

<jdbc:embedded-database type="HSQL" id="dataSource">
</jdbc:embedded-database>

<jdbc:initialize-database data-source="dataSource" enabled="true">
    <jdbc:script location="classpath:schema.sql"/> 
</jdbc:initialize-database>

And in schema.sql at the top I wrote:

SET DATABASE SQL SYNTAX ORA TRUE;

However, when running my test, I get the following error:

java.sql.SQLException: Unexpected token: DATABASE in statement [SET DATABASE SQL SYNTAX ORA TRUE]

Is this a syntax error or a permissions error or something entirely different?

Thanks - also for any pointers that might lead to the answer.

Given that HSQL is the Spring default for jdbc:embedded-database and given the target is Oracle, this scenario should actually be very common. However, I found nothing on the Web even touching the issue.

© Stack Overflow or respective owner

Related posts about hsqldb