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
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