我正在尝试执行包含存储过程的文件。我使用以下代码来执行此操作,但我不断收到错误消息,提示我的语法错误。它似乎不喜欢涉及 DELIMITER 的第一行。有人有什么建议吗?
爪哇
final ResourceDatabasePopulator rdp = new ResourceDatabasePopulator();
rdp.addScript(new ClassPathResource("storedProcedures.sql"));
try {
rdp.populate(dataSource.getConnection());
} catch (SQLException e) {
e.printStackTrace();
}
例外
Caused by: 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 'DELIMITER // DROP PROCEDURE IF EXISTS `GetEvents`// CREATE PROCEDURE `GetEvents`' at line 1