flink 1.12 中如何读取 mysql datetime 字段

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

flink 1.12 中如何读取 mysql datetime 字段

macdoor
在 mysql 中创建表
CREATE TABLE `p_port_packet_loss_5m` (
  `id` binary(16) NOT NULL,
  `coltime` datetime NOT NULL,
...

在flink 中创建表
create table if not exists p_port_packet_loss_5m
(
  id bytes,
  coltime timestamp,
...)
WITH (
  'connector' = 'jdbc',
  'url' = 'jdbc:mysql://ip:port/mydatabase',

在flink sql 客户端执行
select * from p_port_packet_loss_5m;

总是报错
java.lang.ClassCastException: java.time.LocalDateTime cannot be cast to
java.sql.Timestamp

改了若干种数据类型都不行,这种情况该如何处理呢?





--
Sent from: http://apache-flink.147419.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: flink 1.12 中如何读取 mysql datetime 字段

macdoor
我通过实验确认这是升级 MySql JDBC Driver 8.0.23 造成的,回到 MySql JDBC Driver
8.0.22,就没有问题,我提交了 issue

https://issues.apache.org/jira/browse/FLINK-21240



--
Sent from: http://apache-flink.147419.n8.nabble.com/