SQL语句没问题报SQL语句错误问题及解决:

一直报500,SQL语句没问题报SQL语句错误问题及解决:

网页端报错


There was an unexpected error (type=Internal Server Error, status=500).
### Error updating database. Cause: java.sql.SQLSyntaxErrorException: Unknown column '??????' in 'field list' ### The error may involve cn.xdh.dao.TeacherDao.updateByTeacher-Inline ### The error occurred while setting parameters ### SQL: UPDATE xdh_teacher SET name = ??????, mobile= 937615, password= 4848948, add_time= 1576856786, add_ip= 48498 where id =16 ### Cause: java.sql.SQLSyntaxErrorException: Unknown column '??????' in 'field list' ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column '??????' in 'field list'
org.springframework.jdbc.BadSqlGrammarException: 
### Error updating database.  Cause: java.sql.SQLSyntaxErrorException: Unknown column '??????' in 'field list'
### The error may involve cn.xdh.dao.TeacherDao.updateByTeacher-Inline
### The error occurred while setting parameters
### SQL: UPDATE     xdh_teacher     SET     name = ??????,     mobile= 937615,     password= 4848948,     add_time= 1576856786,     add_ip= 48498     where     id =16
### Cause: java.sql.SQLSyntaxErrorException: Unknown column '??????' in 'field list'
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column '??????' in 'field list'

控制台报错


### Error updating database.  Cause: java.sql.SQLSyntaxErrorException: Unknown column '别已被占用了' in 'field list'
### The error may involve cn.xdh.dao.TeacherDao.updateByTeacher-Inline
### The error occurred while setting parameters
### SQL: UPDATE     xdh_teacher     SET     name = 别已被占用了,     mobile= 937615,     password= 4848948,     add_time= 1576856786,     add_ip= 48498     where     id =16
### Cause: java.sql.SQLSyntaxErrorException: Unknown column '别已被占用了' in 'field list'
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column '别已被占用了' in 'field list'] with root cause

java.sql.SQLSyntaxErrorException: Unknown column '别已被占用了' in 'field list'

这个问题是程序识别不出name后面的值, 之前我试了可以使用数字,字母和字符串都不行,也就是数据库只能识别int类型了 并不能识别string类型

我的解决方法:
`

UPDATE
xdh_teacher
SET
name = ${‘“‘+name+’”‘},
mobile= ${mobile},
password= ${password},
add_time= ${add_time},
add_ip= ${add_ip}
where
id =${id}

`

name=${name}换成name = ${'"'+name+'"'}
具体拼接方法我也没太理解 但是它就是好使了

IDEA里面MySQL数据库时区问题:

每次电脑重启 连接IDEA里面的masql数据库时候都会提示我时区错误 实际在cmd里面看时区是正常的,
后来我就找到了这种方案:
在添加mysql的时候 IDEA在添加数据库时里面有Advanced设置 里面有serverTimezone项,在后面的值填写GMT+8即可

Advanced