JDBC_23 - Can't coerce '2022-04-25 09:46:50' of type 'STRING' to column 'last_update_date(DATETIME)'

  • 25 April 2022
  • 7 replies

my configuration:
Use Multi-Row Operation  is close
Max Cache Size Per Batch (Entries) is “-1”

    "table": "tableName",
    "op_type": "I",
    "op_ts": "2022-04-25 09:01:56.000000",
    "current_ts": "2022-04-25T09:02:01.014000",
    "pos": "00000000020000939589",
    "after": {
        "LAST_UPD": "2022-04-25 01:01:54"
Destinations is jdbc producer

I can not update the LAST_UPD into mysql column “last_update_date” 
please give me some advice


Best answer by Bikram 26 April 2022, 04:57

View original

7 replies

Userlevel 2

Can you please refer below sample code and try it and let me know if it helps.

${time:extractDateFromString('2017-05-01 20:15:30.915','yyyy-MM-dd HH:mm:ss.SSS')}

change the column type of  ”last_update_date“  to varchar in mysql , the date can update

Userlevel 2

please change the column name LAST_UPD to last_update_date and i believe it will solve your issue.

by the way I have set a mapping
Field to Column Mapping:
        "paramValue": ?,
        "dataType": "USE_COLUMN_TYPE",
        "columnName": "last_update_date",
        "field": "/after/LAST_UPD"

Userlevel 2

ok , i see . I hope the data type for the column are same in both source and destination. if it’s  not then it will fail.

In this case if the last_updated_date column is string type or data time type then you should send same data type to destination JDBC producer.

how to change the “STRING” type  to “DATETIME” ?   
I need to change “LAST_UPD” ‘s  type to ”DATETIME“
and send it to mysql as “DATETIME’

use JavaScript Evaluator?

it work!  thank you very much