Bug #52678 JDBC DataTruncation values invalid
Submitted: 8 Apr 2010 6:47 Modified: 8 Apr 2010 16:06
Reporter: Peter Rader Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S2 (Serious)
Version:5.1.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: getDataSize getTransferSize
Triage: Triaged: D5 (Feature request)

[8 Apr 2010 6:47] Peter Rader
Description:
Ever a MysqlDataTruncation has been thrown. The getDataSize and getTransferSize has not been filled correclty.

Check out the Docu from DataTruncation.

How to repeat:
Fill an update/insert using too long string value.
The Exception will be a MysqlDataTruncation.
Call getDataSize and getTransferSize on the Excetpino, you will get wrong values.

Suggested fix:
Bugfix the JDBC to get jdbc complicant.
[8 Apr 2010 10:47] Tonci Grgin
Hi Peter and thanks for your report.

Please do attach your complete (DML/DDL inc.) test case. I am particularly interested in jdbcCompliantTruncation setting in your connection string and a SQL_MODE your MySQL server runs in. For details check http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html.
[8 Apr 2010 13:24] Mark Matthews
These attributes of a truncation error are not provided by the server, therefore there's no way for the JDBC driver to give it to an application. Changing the category accordingly.
[8 Apr 2010 13:30] Tonci Grgin
Thanks Mark, Setting Kostja as lead.
[8 Apr 2010 16:06] Peter Rader
Yes, thanks to you Mark.

What usualy will happens now? 
I think the best way is to deprecated those two methods now, right? 

regards 
peter
[8 Apr 2010 17:28] Mark Matthews
It's not possible to deprecate methods in a public API such as JDBC. I suppose we could throw a NotImplemented exception...