shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: 'now()' for column 'UPDATE_TIME' at row 1

Open Belief-WangWei opened this issue 7 years ago • 6 comments

Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: 'now()' for column 'UPDATE_TIME' at row 1

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: insert into ts_anshitianxia_node_data(ID, PARENT_ID,NODE_ID,TAGS, IMAGE, NAME, ALIAS, UNIT,NUM,TS_NODE_PATH,COMPANY_ID,TABLE_NAME,GOODS_ID,UPDATE_TIME,CREATE_USER,UPDATE_USER,IS_DEL,HASHCODE,PRODUCT_COMP_CODE,SLA_COMP_CODE,COMPANY_CODE) values (?,?,?,?,?,?,?,?,?,?,?,?,?,now(),?,?,0,?,?,?,?)

Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: 'now()' for column 'UPDATE_TIME' at row 1

; Data truncation: Incorrect datetime value: 'now()' for column 'UPDATE_TIME' at row 1; nested exception is com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: 'now()' for column 'UPDATE_TIME' at row 1

Is the now() expression not supported in insert statements?

Belief-WangWei avatar Jul 23 '19 06:07 Belief-WangWei

Can you fill necessary information which template provide?

terrymanu avatar Jul 23 '19 09:07 terrymanu

Template:

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details. If no response more than 7 days and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

Which project did you use? Sharding-JDBC or Sharding-Proxy?

Expected behavior

Actual behavior

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

terrymanu avatar Jul 23 '19 09:07 terrymanu

Which version of ShardingSphere did you use? 4.0.0-RC1

Which project did you use? Sharding-JDBC or Sharding-Proxy? Sharding-JDBC Expected behavior insert or update data only using a shard table strategy , and insert udpate_time column with now expression Actual behavior Is not work Reason analyze (If you can) I use mybatis and MySQL, I think ShardingSphere explain now() expression as a string,and the UPDATE_TIME column type is datetime,but now() expression is work with getting current time when I dont use Sharding-JDBC Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. SQL: insert into ts_anshitianxia_node_data(ID, PARENT_ID,NODE_ID,TAGS, IMAGE, NAME, ALIAS, UNIT,NUM,TS_NODE_PATH,COMPANY_ID,TABLE_NAME,GOODS_ID,UPDATE_TIME,CREATE_USER,UPDATE_USER,IS_DEL,HASHCODE,PRODUCT_COMP_CODE,SLA_COMP_CODE,COMPANY_CODE) values (?,?,?,?,?,?,?,?,?,?,?,?,?,now(),?,?,0,?,?,?,?) Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: 'now()' for column 'UPDATE_TIME' at row 1

Belief-WangWei avatar Jul 24 '19 01:07 Belief-WangWei

Template:

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details. If no response more than 7 days and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

Which project did you use? Sharding-JDBC or Sharding-Proxy?

Expected behavior

Actual behavior

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

Which version of ShardingSphere did you use? 4.0.0-RC1

Which project did you use? Sharding-JDBC or Sharding-Proxy? Sharding-JDBC Expected behavior insert or update data only using a shard table strategy , and insert udpate_time column with now expression Actual behavior Is not work Reason analyze (If you can) I use mybatis and MySQL, I think ShardingSphere explain now() expression as a string,and the UPDATE_TIME column type is datetime,but now() expression is work with getting current time when I dont use Sharding-JDBC Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. SQL: insert into ts_anshitianxia_node_data(ID, PARENT_ID,NODE_ID,TAGS, IMAGE, NAME, ALIAS, UNIT,NUM,TS_NODE_PATH,COMPANY_ID,TABLE_NAME,GOODS_ID,UPDATE_TIME,CREATE_USER,UPDATE_USER,IS_DEL,HASHCODE,PRODUCT_COMP_CODE,SLA_COMP_CODE,COMPANY_CODE) values (?,?,?,?,?,?,?,?,?,?,?,?,?,now(),?,?,0,?,?,?,?) Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: 'now()' for column 'UPDATE_TIME' at row 1

Belief-WangWei avatar Jul 24 '19 08:07 Belief-WangWei

Duplicate with https://github.com/apache/incubator-shardingsphere/issues/2225 and https://github.com/apache/incubator-shardingsphere/issues/1497

tuohai666 avatar Jul 25 '19 04:07 tuohai666

Is this problem fixed?

xiaoyuge avatar Jul 09 '24 08:07 xiaoyuge