错误信息:
UPDATE, pos 90, line 1, column 84, token UPDATE : SELECT * FROM QRTZ_LOCKS WHERE SCHED_NAME = 'quartzScheduler' AND LOCK_NAME = ? FOR UPDATE [See nested exception: java.sql.SQLException: sql injection violation, syntax error: syntax error, not support option : UPDATE, pos 90, line 1, column 84, token UPDATE : SELECT * FROM QRTZ_LOCKS WHERE SCHED_NAME = 'quartzScheduler' AND LOCK_NAME = ? FOR UPDATE]]
问题原因:
在Quartz中有一个加锁的SQL语句配置selectWithLockSQL,默认语句为:SELECT * FROM {0}LOCKS WHERE LOCK_NAME = ? FOR UPDATE
但是这个语句在低版本的sqlserver中是不支持的
解决方法:
自定义selectWithLockSQL=SELECT* FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?
yml配置如下:
quartz:
.....省略其他配置.....
properties:
org:
quartz:
jobStore:
selectWithLockSQL: SELECT* FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?