解决:nested exception is org.springframework.jdbc.BadSqlGrammarException:

时间:2024-03-20 18:33:05

项目:spring boot+mybatis+mysql

报错:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc,execute_sql,exa_state,trial_name,task_startstop_date,send_ti' at line 12

解决:nested exception is org.springframework.jdbc.BadSqlGrammarException:

解决:

一开始百思不得其解,我明明都没有“send_ti”这个字段。后来看到有人说,“desc”是SQL关键字,不能拿来作为字段名。于是我都改了,就行了。顺便说一下,“desc”是降序的意思。

 

那还需要注意哪些sqk关键字?

  • order(排序,容易当成订单)
  • like(模糊查询,容易当成点赞)

解决:nested exception is org.springframework.jdbc.BadSqlGrammarException: