H2和MySQL的兼容性问题

时间:2014-06-07 11:35:06

标签: mysql sql testing h2 liquibase

我使用H2进行与Liquibase的集成测试,似乎存在兼容性问题。

一个简单的更改列函数不会传递给H2,因为它在MySQL发行版上完美运行。

这是查询:

ALTER TABLE `designs`
ALTER COLUMN `description` `description` TEXT NULL DEFAULT NULL AFTER `created`;

错误:

2014-06-07 14:27:05,708 [DEBUG] [NewPooledConnection,handleThrowable(),430] - com.mchange.v2.c3p0.impl.NewPooledConnection@78af2ac3 handling a throwable.
org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "ALTER TABLE DESIGNS 
ALTER COLUMN DESCRIPTION TEXT NULL DEFAULT NULL AFTER[*] CREATED "; SQL statement:
ALTER TABLE designs ALTER COLUMN description TEXT NULL DEFAULT NULL AFTER created [42000-178]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)

一些配置:

repository.connectionString = jdbc:h2:mem:db;MODE=MySQL;DB_CLOSE_ON_EXIT=FALSE
repository.driver = org.h2.Driver
repository.username = sa
repository.password = 

任何想法如何解决这个问题?据我所知H2应该与Mysql兼容

1 个答案:

答案 0 :(得分:8)

As documented,H2(达到某一点)与其他数据库(如HSQLDB,MySQL和PostgreSQL)兼容。但是在某些方面H2不相容。

另请参阅SQL syntax supported by H2