Bug #72898 mysql jdbc process zero date
Submitted: 6 Jun 2014 12:08 Modified: 14 Aug 2019 19:30
Reporter: yu xie Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Cluster: Cluster/J Severity:S3 (Non-critical)
Version:5.x OS:Any
Assigned to: CPU Architecture:Any
Tags: zero date datetime timestamp

[6 Jun 2014 12:08] yu xie
Description:
date field value is '0000-00-00' or datetime field value is '0000-00-00 00:00:00',but not use "zeroDateTimeBehavior=convertToNull" on JDBC URL(because target column can not null).
we can use "new String(getBytes(int))",but we can't use this method when use "useCursorFetch=true&defaultFetchSize=16384" on JDBC URL or call "statement.enableStreamingResults()",so,we can only use catch exception and decide exception message

How to repeat:
1、
create table t1(
   v_date date,
   v_datetime datetime
)
2、
insert into t1(v_date,v_datetime)
values('0000-00-00','0000-00-00 00:00:00');

3、Java JDBC URL use "useCursorFetch=true&defaultFetchSize=16384"(not use "zeroDateTimeBehavior=convertToNull")

4、getBytes(index)

then exception message like :
Value '0000-00-00' can not be represented as java.sql.Date
Value '0000-00-00' can not be represented as java.sql.Timestamp

Suggested fix:
can success use "getBytes(int)" method when useCursor or streamResults.

I think that is the problem of code reuse
[14 Aug 2019 19:30] MySQL Verification Team
Hi,

'0000-00-00' and '0000-00-00 00:00:00' are invalid values by sql standard

all best
Bogdan