Bug #76036 delimiter statement fails in mysql jdbc driver but works in workbench on v5.6
Submitted: 25 Feb 2015 0:58 Modified: 27 Feb 2015 18:45
Reporter: Jim Mason Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.6 OS:Any (all platforms for 5.6)
Assigned to: CPU Architecture:Any
Tags: jdbc block terminator failure

[25 Feb 2015 0:58] Jim Mason
Description:
MySQL  5.6 jdbc driver fails with the DELIMITER statement to mark a block for execution.
By comparison the same code works fine in MySQL workbench.
Without a fix in the jdbc driver you can't execute "create procedure", "create function" etc through the jdbc driver eliminating many scripting solutions on all Java platforms.

Please fix the jdbc driver asap to support the block terminator statement definition that works fine in the workbench.

How to repeat:
try this block in the workbench or from the jdbc driver in a groovy script:

DELIMITER //
CREATE FUNCTION fmGetUUID() RETURNS CHAR 
	DETERMINISTIC
BEGIN
	SET @myid = UUID();
    RETURN @myid;
END
//
DELIMITER ;

Suggested fix:
fix the block terminator feature in the jdbc driver
[27 Feb 2015 18:45] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

DELIMITER statement is for clients which do not have a way to have a terminated string, such as MySQL command line client.

You don't need to use DELIMITER in c/J programs. You can simply write:

CREATE FUNCTION fmGetUUID() RETURNS CHAR 
	DETERMINISTIC
BEGIN
	SET @myid = UUID();
    RETURN @myid;
END

And stored function will be created.
[11 Jul 2019 12:08] Richard Tingle
I'm not sure this is helpful. Stored procedures are going to be developed in mySQL workbench. They should work the same. Especially as all you get is the cryptic "Check your manual" error if you make a mistake. 

Just removing the DELIMITER lines doesn't seem to give a valid stored procedure either
[11 Jul 2019 13:29] Richard Tingle
Seems that as described at https://stackoverflow.com/a/56990223/2187042 ?allowMultiQueries=true must be included in the connection string for the suggested approach to work