发布支持mysql8.0的writer和reader
默认从官网下载的datax,是不支持mysql8.0的。直接调用会报错。
Description:[连接数据库失败. 请检查您的 账号、密码、数据库名称、IP、Port或者向 DBA 寻求帮助(注意网络环境).]. - 具体错误信息为:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
要修正问题很简单,将pom.xml的库更新为8.0,再重新编译就可以了。
为了避免麻烦,我已经打包好。需要的人可以直接下载,覆蓋原文件就可以了。
编译参考文章:
https://www.cnblogs.com/zifan/p/12550747.html
mysqlwriter,mysqlreader下载链接
https://wws.lanzous.com/b01hkhkij
密码:37ca
附,我的同步job
{ "job": { "content": [ { "reader": { "name": "mysqlreader", "parameter": { "connection": [ { "jdbcUrl": ["jdbc:mysql://0.0.0.:3306/db?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&useSSL=false"], "querySql":[ "select MonitorPointID, ProjectID, PointName, Mileage, Remark,'JK-ZBTT-DSFJC-Inclinometer' as DataCode, CreateUserId, CreateUserName, CreateDate, ModifyUserId, ModifyUserName, ModifyDate from qc_monitorpoint where CustomMonitorCode='CX' and ProjectID='c23bd52e-50f7-4dda-9c2c-f325dee12b17'" ] } ], "password": "password", "username": "username" } }, "writer": { "name": "mysqlwriter", "parameter": { "column": [ "PointID", "ProjectID", "PointName", "Mileage", "Remark", "DataCode", "CreateUserId", "CreateUserName", "CreateDate", "ModifyUserId", "ModifyUserName", "ModifyDate"], "connection": [ { "jdbcUrl": "jdbc:mysql://localhost:3306/db?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&useSSL=false", "table": ["fp_points"] } ], "password": "password", "preSql": [], "session": [], "username": "username", "writeMode": "update" } } } ], "setting": { "speed": { "channel": "1" } } } }