H2 Syntax error in SQL statement expected "identifier"

H2 About 392 words

错误信息

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "create table [*]user (xxx)"; expected "identifier"; SQL statement:
create table user (xxx) [42001-214]

错误原因

userH2数据库中的关键字。

解决方法

方法一

jdbc url中添加;NON_KEYWORDS=USER

spring:
  datasource:
    url: jdbc:h2:mem:testdb;NON_KEYWORDS=USER

方法二

修改表名。

相关 issue

https://github.com/h2database/h2database/issues/3363

Views: 1,993 · Posted: 2023-03-21

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh