You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kettle 9.2无法连接MySQL,修复.jar包后问题仍未解决

Kettle 9.2 无法连接MySQL:通信链路失败问题排查方案

问题描述

使用Kettle 9.2执行作业时无法连接MySQL,报错核心为通信链路失败,错误日志如下:

2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - ERROR (version 9.2.0.0-290, build 9.2.0.0-290 from 2021-06-02 06.36.08 by buildguy) : A serious error occurred during job execution:
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Error occurred while trying to connect to the database
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Connection failed. Verify all connection parameters and confirm that the appropriate driver is installed.
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Communications link failure
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - ERROR (version 9.2.0.0-290, build 9.2.0.0-290 from 2021-06-02 06.36.08 by buildguy) : org.pentaho.di.core.exception.KettleDatabaseException:
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Error occurred while trying to connect to the database
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Connection failed. Verify all connection parameters and confirm that the appropriate driver is installed.
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Communications link failure
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.core.database.Database.normalConnect(Database.java:497)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.core.database.Database.connect(Database.java:389)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.core.database.Database.connect(Database.java:360)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.core.database.Database.connect(Database.java:350)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.job.Job.beginProcessing(Job.java:987)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.job.Job.execute(Job.java:477)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.job.Job.run(Job.java:389)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Caused by: org.pentaho.di.core.exception.KettleDatabaseException:
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Connection failed. Verify all connection parameters and confirm that the appropriate driver is installed.
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Communications link failure
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:605)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.core.database.Database.normalConnect(Database.java:481)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  ... 6 more
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at java.sql.DriverManager.getConnection(DriverManager.java:664)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at java.sql.DriverManager.getConnection(DriverManager.java:208)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:589)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  ... 7 more
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 - The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.NativeSession.connect(NativeSession.java:120)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818)
2023/09/13 17:21:30 - ant_pfteam_vs_prodazi1 -  ... 13 more

已尝试修复MySQL驱动jar包,但问题仍未解决。

排查与解决方案

1. 验证MySQL服务状态与网络连通性

  • 确认MySQL服务是否正常运行:Linux执行systemctl status mysql,Windows查看服务列表,确保服务处于启动状态。
  • 测试网络连通性:执行ping <MySQL服务器IP>确认路由可达;再用telnet <MySQL服务器IP> <端口>(默认3306)验证端口是否开放。

2. 检查连接参数的正确性

  • 主机/端口:确认Kettle配置的IP、端口与实际一致,避免localhost解析问题,可替换为真实IP测试。
  • 账号权限:验证用户名密码正确,且该账号允许Kettle所在机器访问(MySQL客户端执行SELECT user, host FROM mysql.user;确认)。
  • 连接属性:针对MySQL 8.0+,必须添加以下属性:
    • serverTimezone=Asia/Shanghai(匹配服务器时区)
    • useSSL=false(未配置SSL时禁用)
    • allowPublicKeyRetrieval=true(解决公钥检索限制)

3. 确认驱动版本兼容性

  • Kettle 9.2适配MySQL Connector/J 8.0.x版本,避免使用5.x版本(尤其连接MySQL 8.0+时)。
  • 驱动jar包需放在Kettle安装目录的data-integration/lib下,删除重复或冲突的驱动包(如同时存在5.x和8.x版本)。
  • 放置驱动后重启Kettle,确保驱动加载生效。

4. 检查MySQL服务器配置

  • 绑定地址:修改my.cnf/my.ini中的bind-address为0.0.0.0或允许访问的IP,避免仅本地访问限制,修改后重启MySQL。
  • 防火墙规则:开放MySQL服务器3306端口,允许Kettle所在机器的IP访问。
  • 连接数限制:执行SHOW VARIABLES LIKE 'max_connections';,若连接数已满,调整max_connections参数。

5. 测试基础连接

  • 使用MySQL官方客户端(命令行、Workbench)从Kettle所在机器连接服务器,若客户端也无法连接,问题出在MySQL或网络,而非Kettle配置。

内容的提问来源于stack exchange,提问作者shipson paulose

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 22:02:01