请大神帮忙看看Java调用cmd命令执行sql脚本的报错怎么处理
执行sql脚本的时候出错,不知道问题在哪
报错信息是:
ERROR 1064 (42000) at line 3: 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 ';
调用代码:
cmdStr = "cmd /c mysql -h "+json.getString("dbUrl")+" -P3336 -u "+json.getString("dbUserName")+" -p"+json.getString("dbPassword")+" --force "+json.getString("dbEName")+" < "+path;
process=Runtime.getRuntime().exec(cmdStr);
sql脚本:
DELIMITER ;;
CREATE TRIGGER `tr_test_insert` BEFORE INSERT ON `test` FOR EACH ROW begin set new.id = str_to_date('2012-01-01', 'YYYY-MM-DD'); end
;;
DELIMITER ;
DELIMITER ;;
CREATE TRIGGER `tr_test_update` BEFORE UPDATE ON `test` FOR EACH ROW begin set new.id = str_to_date('2012-01-01', 'YYYY-MM-DD'); end
;;
DELIMITER ;