Mybatis使用“”出现Cause: java.sql.SQLException:

今天在使用Mybatis时出现错误:

### Error updating database.  Cause: java.sql.SQLException: MYSQL: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 'CHECKNOTPASSREASON='驾驶证未满一年以上;其他原因:qwe' 
		where OID' at line 3
### The error may involve com.zte.ums.ztev.database.dao.drivermgt.DriverMgtDao.modifyDriver-Inline
### The error occurred while setting parameters
### SQL: update BUS_DRIVER    SET CHECKTHROUGH=?    CHECKNOTPASSREASON=?    where OID = ?
### Cause: java.sql.SQLException: MYSQL: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 'CHECKNOTPASSREASON='驾驶证未满一年以上;其他原因:qwe' 
		where OID' at line 3

检查发现是因为:

DRIVERLICENSESCAN=#{driverLicenseScan},
			ADDRESS=#{address},
			CHECKTHROUGH=#{checkThrough}
			CHECKNOTPASSREASON=#{checkNotPassReason}
			USERGRADE=#{userGrade}

中“ #{checkThrough}”,“ #{userGrade}”和“ #{checkNotPassReason}”后面缺少逗号“,”

改为:

DRIVERLICENSESCAN=#{driverLicenseScan},
			ADDRESS=#{address},
			CHECKTHROUGH=#{checkThrough},
			CHECKNOTPASSREASON=#{checkNotPassReason},
			USERGRADE=#{userGrade},
就好了!

你可能感兴趣的:(数据库)