-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Steffen Harbich opened SPR-16927 and commented
Consider the following script (quartz tables_mysql_innodb.sql):
#
# In your Quartz properties file, you'll need to set
# org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#
#
# By: Ron Cordell - roncordell
# I didn't see this anywhere, so I thought I'd post it here. This is the script from Quartz to create the tables in a MySQL database, modified to use INNODB instead of MYISAM.
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
...It is executed using QuartzAutoConfiguration's QuartzDataSourceInitializer for mysql. The ScriptUtils class will finally parse this script as 2 statements in line 464 (https://github.com/spring-projects/spring-framework/blob/master/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ScriptUtils.java#L464) which is wrong I think. Executing those statements results in a syntax exception because only one statement can be executed at a time:
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 'DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS; DROP TABLE IF EXISTS QRTZ_SCHEDUL' at line 9
If I remove the comments from the script then everything works fine as expected. I suspect that parsing of apostrophe in comment doesn't work as intended.
Affects: 5.0.6
Reference URL: https://stackoverflow.com/questions/50793308