使用zeppelin 通过jdbc 连接 mysql时,遇到空时间字段抛错
can not be represented as java.sql.Timestamp
解决办法:
解决办法:
给jdbc url加上 zeroDateTimeBehavior参数:
datasource.url=jdbc:mysql://localhost:3306/dbName?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
zeroDateTimeBehavior=round是为了指定MySql中的DateTime字段默认值查询时的处理方式;默认是抛出异常,
对于值为0000-00-00 00:00:00(默认值)的纪录,如下两种配置,会返回不同的结果:
zeroDateTimeBehavior=round 0001-01-01 00:00:00.0
zeroDateTimeBehavior=convertToNull null
如下图:
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27378/viewspace-2137677/
,如需转载,请注明出处,否则将追究法律责任。