Bug #60836 useServerPrepStmt default value should be true as is in other languages
Submitted: 11 Apr 2011 17:49 Modified: 23 Dec 2013 10:48
Reporter: John Main Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: Alexander Soklakov CPU Architecture:Any
Tags: connectorj, PreparedStatement, useServerPrepStmt

[11 Apr 2011 17:49] John Main
Description:
All other MySql clients I know (C, PHP, C++, C#) are using the COM_PREPARE commands upon prepareStatement by default.
ConnectorJ require to set useServerPrepStmt in the URL in order to do it.
This has impacts on performance, and is inconsistence with other languages.

I understand that this is a result of code evolution where ConnectorJ supported preparedStatement before the server supported it, but this has been solved since version 3.X, and now we're at 5.5 and we still suffer from that.

How to repeat:
Default behavior of the connector upon calling prepareStatement results in sending COM_QUERY to the server upon execute and not COM_PREPARE and then COM_EXECUTE

Suggested fix:
Change default value of useServerPrepStmt to true
[11 Apr 2011 17:52] Mark Matthews
This would have to wait for a major version release of Connector/J as it will cause behavior changes. Certain prepared statements still perform differently, or even in buggy ways with still relevant GA versions of the MySQL server.
[23 Dec 2013 10:48] Alexander Soklakov
We won't fix this for current Connector/J 5.1 but will take this request into account for next major version.