我正在使用以下sql:
DELIMITER $$
DROP PROCEDURE IF EXISTS `get_auto_increment_settings`$$
CREATE PROCEDURE `get_auto_increment_settings`()
BEGIN
select @@global.auto_increment_offset as 'offset', @@global.auto_increment_increment as 'increment' ;
END $$
DELIMITER ;
我将其存储在 db_auto_increment_settings_procedure.sql 中,当我尝试从 ant 执行此操作时,我面临以下错误:
[sql] Executing resource: /mysql/install/db_auto_increment_settings_procedure.sql
[sql] Failed to execute: DELIMITER
[sql] com.mysql.jdbc.exceptions.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' at line 1
[sql] Failed to execute: DELIMITER ;
[sql] com.mysql.jdbc.exceptions.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' at line 1
分隔符仅由 mysql 客户端使用(不在 API、驱动程序等上)。
所以,这是行不通的。
查看您的错误消息:-
[sql] Executing resource: /mysql/install/db_auto_increment_settings_procedure.sql
[sql] Failed to execute: DELIMITER
很确定这在 Linux 系统中可以工作
mysql -u root -pxxx -h yyy < YOUR_SQL.sql
如果适用,您只需使用 mysql 客户端手动创建存储过程,
并且是一个不费吹灰之力的解决方案。
如果您需要动态创建它,
该文档可能提供一些洞察信息
http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-basic.html http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-basic.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)