1
저장 프로 시저가 포함 된 파일을 실행하려고합니다. 이렇게하려면 다음 코드를 사용하지만 내 구문이 잘못되었다는 오류가 계속 발생합니다. DELIMITER가 포함 된 첫 번째 줄을 좋아하지 않는 것 같습니다. 누구든지 어떤 제안이 있습니까?Java Spring - 파일에서 MySQL 쿼리 실행
자바
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
Spring JDBC에서 ResourceDatabasePopulator와 같은 것이 있는지 몰랐기 때문에이 질문에 투표했습니다. 이제 나야. 감사! –
해결 방법이 있습니까? 나는 같은 문제가 발생했습니다, SQL은 mysqldump에서 생성되므로 제대로 포맷 된 것으로 가정합니다. – AgentRegEdit