码迷,mamicode.com
首页 > 数据库 > 详细

ETL-kettle报错--org.gjt.mm.mysql.Driver

时间:2020-04-04 00:01:05      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:super   rac   hide   instance   ips   select   art   tst   throw   

技术图片

 

 细节:

技术图片
org.pentaho.di.core.exception.KettleDatabaseException: 
Error occurred while trying to connect to the database

Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.


    at org.pentaho.di.core.database.Database.normalConnect(Database.java:472)
    at org.pentaho.di.core.database.Database.connect(Database.java:370)
    at org.pentaho.di.core.database.Database.connect(Database.java:341)
    at org.pentaho.di.core.database.Database.connect(Database.java:331)
    at org.pentaho.di.ui.trans.steps.update.UpdateDialog.getSchemaNames(UpdateDialog.java:912)
    at org.pentaho.di.ui.trans.steps.update.UpdateDialog.access$1200(UpdateDialog.java:76)
    at org.pentaho.di.ui.trans.steps.update.UpdateDialog$15.widgetSelected(UpdateDialog.java:543)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.pentaho.di.ui.trans.steps.update.UpdateDialog.open(UpdateDialog.java:561)
    at org.pentaho.di.ui.spoon.delegates.SpoonStepsDelegate.editStep(SpoonStepsDelegate.java:120)
    at org.pentaho.di.ui.spoon.Spoon.editStep(Spoon.java:8662)
    at org.pentaho.di.ui.spoon.trans.TransGraph.editStep(TransGraph.java:3293)
    at org.pentaho.di.ui.spoon.trans.TransGraph.mouseDoubleClick(TransGraph.java:785)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.pentaho.di.ui.trans.steps.update.UpdateDialog.open(UpdateDialog.java:561)
    at org.pentaho.di.ui.spoon.delegates.SpoonStepsDelegate.editStep(SpoonStepsDelegate.java:120)
    at org.pentaho.di.ui.spoon.Spoon.editStep(Spoon.java:8662)
    at org.pentaho.di.ui.spoon.trans.TransGraph.editStep(TransGraph.java:3293)
    at org.pentaho.di.ui.spoon.trans.TransGraph.mouseDoubleClick(TransGraph.java:785)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1381)
    at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:7817)
    at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9179)
    at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:707)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92)
Caused by: org.pentaho.di.core.exception.KettleDatabaseException: 
Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

    at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:583)
    at org.pentaho.di.core.database.Database.normalConnect(Database.java:456)
    ... 43 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2333)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:208)
    at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:567)
    ... 44 more
Caused by: java.net.UnknownHostException: 印度rsrush-香港从库
    at java.net.InetAddress.getAllByName0(InetAddress.java:1280)
    at java.net.InetAddress.getAllByName(InetAddress.java:1192)
    at java.net.InetAddress.getAllByName(InetAddress.java:1126)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:247)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:294)
    ... 59 more
报错细节

解释:

org.gjt.mm.mysql.Driver 是早期的驱动名称,后来就改名为com.mysql.jdbc.Driver,现在一般都推荐使用com.mysql.jdbc.Driver。

在最新版 本的mysql jdbc驱动中,为了保持对老版本的兼容,仍然保留了org.gjt.mm.mysql.Driver,但是实际上 org.gjt.mm.mysql.Driver中调用了com.mysql.jdbc.Driver,因此现在这两个驱动没有什么区别。

其他说法:

org.gjt.mm.mysql.Driver是当时最好的MySQL?

JDBC,但不是MySQL公司的,然后MySQL将MM的JDBC驱动 收为官方的JDBC驱动,所以将驱动的package也该了,但还保留了org.gjt.mm.mysql.Driver这个路径的引用,也就是你使用新 版的JDBC驱动时还可以通过这个来引用,你打开下载的新版JDBC驱动的jar文件可以看到,只有一个文件的目录是org.gjt.mm.mysql, 就是为了兼容而设计的。

源码查看:org.gjt.mm.mysql.Driver中的除打包之外的代码如下

public class Driver extends com.mysql.jdbc.Driver {
    // ~ Constructors
   
    public Driver() throws SQLException {
        super();
    }
}
所以这个Driver继承了com.mysql.jdbc.Driver并且直接使用了它的构造方法,并无其他修改,所以二者完全一样,并无区别,至于什么历史原因都不重要了,反正二者一样即可
为和oracle等驱动样式一样,所以我选择写com.mysql.jdbc.Driver.

解决方法:安装Mysql驱动。

1. Mysql官网下载对应驱动;

  https://dev.mysql.com/downloads/file/?id=468318%20

2. 将驱动放在如下位置:

  1. \pdi-ce-7.1.0.0-12\data-integration\lib

  2. \pdi-ce-7.1.0.0-12\data-integration\libswt\win64:(64位系统)

ETL-kettle报错--org.gjt.mm.mysql.Driver

标签:super   rac   hide   instance   ips   select   art   tst   throw   

原文地址:https://www.cnblogs.com/wqbin/p/12629580.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!