java.sql.SQLSyntaxErrorException:用户缺少权限或找不到对象:FIELD
java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD
我正在使用 HSQLBD + Mybatis + Spring.
为我的项目编写 junit
我有 sql 个用于创建和插入的脚本。
select 中的所有字段都存在于创建脚本中,但我仍面临以下错误。
可能是什么原因?
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD
### The error may exist in cTbl.xml
### The error may involve x.getyzOrders
### The error occurred while executing a query
### SQL: SELECT fields FROM Table WHERE field1 IN (?,?,?,?,?,?) ORDER BY FIELD(field1 , ? , ? , ? , ? , ? , ? )
### Cause: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD
SQL 说法不正确。
如果 table 称为 FIELDS 并且列称为 FIELD1、FIELD2 等,则 SELECT 语句应如下所示:
SELECT fields.* FROM fields WHERE field1 IN (?,?,?,?,?,?) ORDER BY field1, field2, field3, field4, field5
您不能在 ORDER BY 后使用问号
我正在使用 HSQLBD + Mybatis + Spring.
为我的项目编写 junit我有 sql 个用于创建和插入的脚本。
select 中的所有字段都存在于创建脚本中,但我仍面临以下错误。 可能是什么原因?
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD
### The error may exist in cTbl.xml
### The error may involve x.getyzOrders
### The error occurred while executing a query
### SQL: SELECT fields FROM Table WHERE field1 IN (?,?,?,?,?,?) ORDER BY FIELD(field1 , ? , ? , ? , ? , ? , ? )
### Cause: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD
SQL 说法不正确。
如果 table 称为 FIELDS 并且列称为 FIELD1、FIELD2 等,则 SELECT 语句应如下所示:
SELECT fields.* FROM fields WHERE field1 IN (?,?,?,?,?,?) ORDER BY field1, field2, field3, field4, field5
您不能在 ORDER BY 后使用问号