我正在关注this tutorial,它要求我在资源文件夹中创建一个data.sql文件:
INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, EMAIL, ENABLED, LASTPASSWORDRESETDATE) VALUES (1, 'admin', '$2a$08$lDnHPz7eUkSi6ao14Twuau08mzhWrL4kyZGGU5xfiGALO/Vxd5DOi', 'admin', 'admin', 'admin@admin.com', 1, PARSEDATETIME('01-01-2016', 'dd-MM-yyyy'));
INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, EMAIL, ENABLED, LASTPASSWORDRESETDATE) VALUES (2, 'user', '$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC', 'user', 'user', 'enabled@user.com', 1, PARSEDATETIME('01-01-2016','dd-MM-yyyy'));
INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, EMAIL, ENABLED, LASTPASSWORDRESETDATE) VALUES (3, 'disabled', '$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC', 'user', 'user', 'disabled@user.com', 0, PARSEDATETIME('01-01-2016','dd-MM-yyyy'));
INSERT INTO AUTHORITY (ID, NAME) VALUES (1, 'ROLE_USER');
INSERT INTO AUTHORITY (ID, NAME) VALUES (2, 'ROLE_ADMIN');
INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (1, 1);
INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (1, 2);
INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (2, 1);
INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (3, 1);
当我运行我的应用程序时,我收到错误:
org.springframework.jdbc.datasource.init.ScriptStatementFailedException:无法执行URL [file:/ C:/ Users / alucardu / Documents / projects / movieseat / backend / target / classes / data]的SQL脚本语句#1。 sql]:INSERT INTO USER(ID,USERNAME,PASSWORD,FIRSTNAME,LASTNAME,EMAIL,ENABLED,LASTPASSWORDRESETDATE)VALUES(1,'admin','$ 2a $ 08 $ lDnHPz7eUkSi6ao14Twuau08mzhWrL4kyZGGU5x fiGALO / Vxd5DOi','admin','admin','admin @ admin.com',1,PARSEDATETIME('01 -01-2016','dd-MM-yyyy'));嵌套异常是com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:FUNCTION movieseat.PARSEDATETIME不存在
我已查看a source
解析字符串并返回时间戳。最重要的格式字符是:y年,M月,d天,H小时,m分钟,秒。有关格式的详细信息,请参阅java.text.SimpleDateFormat。
示例:
CALL PARSEDATETIME('Sat, 3 Feb 2001 03:05:06 GMT',
'EEE, d MMM yyyy HH:mm:ss z', 'en', 'GMT')
有人可以解释SQL文件中的错误吗?