Bug #87304 rewriteBatchedStatements generates invalid SQL and exception
Submitted: 3 Aug 2017 14:46 Modified: 4 Sep 2017 10:51
Reporter: Ifunga Ndana Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:6.0.6 OS:Any (Windows 10)
Assigned to: Assigned Account CPU Architecture:Any
Tags: batch, invalid, REWRITEBATCHEDSTATEMENTS, SQL

[3 Aug 2017 14:46] Ifunga Ndana
Description:
The rewriteBatchedStatements=true statement creates an invalid SQL statement with inserts.

Specifically inserts that end with the ';' terminator cause this issue.

Omitting the ';' fixes the problem.

Adding ';' causes the first batch insert block to have a terminator thus invalidating the batch i.e

INSERT INTO JdsStoreOldFieldValues(EntityGuid, FieldId, Sequence, TextValue) VALUES('guidBulk8', 5002, 0, 'A');,
('guidBulk7', 5002, 0, 'A'),
('guidBulk9', 5002, 0, 'A'),
('guidBulk4', 5002, 0, 'A'),......

The problem is that ';' character on the first argument block

How to repeat:
See description

Suggested fix:
Seems like a simple fix as only one trailing ';' character needs to be omitted
[4 Aug 2017 10:51] Chiranjeevi Battula
Hello  Ifunga Ndana,

Thank you for the bug report.
Could you please provide repeatable test case (exact steps, connection string, sample code etc. - please make it as private if you prefer) to confirm this issue at our end?

Thanks,
Chiranjeevi.
[24 Aug 2017 16:39] Mark Matthews
Technically ";" at the end of a prepared statement is not valid SQL (really, the JDBC driver should throw an exception when preparing anything in this case). ";" is the "delimiter" that only the command line client is aware of.
[5 Sep 2017 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".