创建VIEW时出现HSQLDB错误

时间:2018-02-14 15:38:17

标签: integration-testing hsqldb in-memory-database

我正在使用HSQLDB进行集成测试,以在内存中创建表和视图。当我运行我的测试时,它无法创建视图。我得到了下面提到的异常

Error thrown executing CREATE VIEW `ipv6space_view` AS SELECT 
`ipv6space`.`id` AS `id`, `ipv6space`.`ipvpn_id` AS `ipvpn_id`, 
INET6_NTOA(`ipv6space`.`base_address`) AS `base_address`, 
`ipv6space`.`length` AS `length`, `ipv6space`.`type` AS `type`, 
`ipv6space`.`purpose` AS `purpose`, `ipv6space`.`ptr` AS `ptr`, 
`ipv6space`.`abonnement_id` AS `abonnement_id` FROM `ipv6space` : 
unexpected token:  required: AS
java.sql.SQLSyntaxErrorException: unexpected token:  required: AS
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)

当我使用MYSQL尝试时,同样的语句可以正常工作。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

您需要使用以下语句打开MySQL兼容模式:

 set database sql syntax mys true