You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 443435766 <44...@qq.com> on 2020/09/10 14:01:41 UTC

Re:Re: localtimestamp和current_timestamp插入mysql时区错乱

1、timestamp也是测过的,结果是一样的,后面才改成varchar的 2、上面的例子后面就是贴测试结果

localtimestamp和current_timestamp插入mysql时区错乱

Posted by xuzh <hu...@qq.com>.
1、timestamp也是测过的,结果是一样的,后面才改成varchar的&nbsp;
2、上面的例子后面就是贴测试结果
插入时间是:2020-09-09 15:25:55.416&nbsp;
插入后结果:&nbsp;
local_dtm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | curr_dtm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| local_dtm_no_zone &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| curr_dtm_no_zone &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp;
------------------------ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| ------------------------ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| ------------------------ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | ------------------------ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp;
2020-09-09 02:25:55.416 &nbsp;| 2020-09-08 18:25:55.416 | 2020-09-09 02:25:55.416 | 2020-09-08 18:25:55.416 |&nbsp;



CREATE TABLE `sink2` (&nbsp;
&nbsp; `local_dtm` varchar(100) DEFAULT NULL,&nbsp;
&nbsp; `curr_dtm` varchar(100) DEFAULT NULL,&nbsp;
&nbsp; `local_dtm_no_zone` varchar(100) DEFAULT NULL,&nbsp;
&nbsp; `curr_dtm_no_zone` varchar(100) DEFAULT NULL&nbsp;
) ENGINE=InnoDB DEFAULT CHARSET=utf8&nbsp;


drop table if exists sk;&nbsp;
CREATE TABLE sk (	
&nbsp;local_dtm TIMESTAMP,&nbsp;
&nbsp;curr_dtm TIMESTAMP,&nbsp;
&nbsp;local_dtm_no_zone &nbsp; TIMESTAMP WITHOUT TIME ZONE,&nbsp;
&nbsp;curr_dtm_no_zone &nbsp; TIMESTAMP WITHOUT TIME ZONE&nbsp;
)&nbsp;
WITH (&nbsp;
&nbsp; &nbsp; 'connector' = 'jdbc',&nbsp;
&nbsp; &nbsp; 'url' = 'jdbc:mysql://10.12.5.37:3306/rs_report?useUnicode=true&amp;amp;characterEncoding=UTF-8',&nbsp;
&nbsp; &nbsp; 'table-name' = 'sink2',&nbsp;
&nbsp; &nbsp; 'driver' = 'com.mysql.jdbc.Driver',&nbsp;
&nbsp; &nbsp; 'username' = 'dps',&nbsp;
&nbsp; &nbsp; 'password' = 'dps1234'&nbsp;
);&nbsp;


insert into sk values(localtimestamp,current_timestamp,localtimestamp	,current_timestamp);&nbsp;


插入时间是:2020-09-09 15:25:55.416	
插入后结果:&nbsp;
local_dtm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | curr_dtm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| local_dtm_no_zone &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| curr_dtm_no_zone &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp;
------------------------ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| ------------------------ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| ------------------------ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | ------------------------ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp;
2020-09-09 02:25:55.416 &nbsp;| 2020-09-08 18:25:55.416 | 2020-09-09 02:25:55.416 | 2020-09-08 18:25:55.416 |&nbsp;


------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "xuzh"                                                                                    <443435766@qq.com&gt;;
发送时间:&nbsp;2020年9月10日(星期四) 晚上10:01
收件人:&nbsp;"xbjtdcq"<xbjtdcq@gmail.com&gt;;"user-zh"<user-zh@flink.apache.org&gt;;

主题:&nbsp;Re:Re: localtimestamp和current_timestamp插入mysql时区错乱 



1、timestamp也是测过的,结果是一样的,后面才改成varchar的 2、上面的例子后面就是贴测试结果