1. 程式人生 > 實用技巧 >kettle連線報錯

kettle連線報錯

如何檢視埠號

cmd命令列

輸入mysql -u root -p密碼進入mysql

輸入show global variables like 'port';

就可以看到埠號3306

測試資料庫連結

報錯

錯誤連線資料庫 [ceshi] : 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)
Unknown database 
'vincent' 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) Unknown database 'vincent' 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.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:83) at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestResults(DatabaseFactory.java:
112) at org.pentaho.di.core.database.DatabaseMeta.testConnectionSuccess(DatabaseMeta.java:2811) at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:621) 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.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313) at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:157) at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:141) at org.pentaho.ui.xul.swt.tags.SwtButton.access$500(SwtButton.java:43) at org.pentaho.ui.xul.swt.tags.SwtButton$4.widgetSelected(SwtButton.java:137) 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.eclipse.jface.window.Window.runEventLoop(Window.java:820) at org.eclipse.jface.window.Window.open(Window.java:796) at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:80) at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:47) at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:116) at org.pentaho.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:61) at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.newConnection(SpoonDBDelegate.java:495) at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.newConnection(SpoonDBDelegate.java:482) at org.pentaho.di.ui.spoon.Spoon.doubleClickedInTree(Spoon.java:3094) at org.pentaho.di.ui.spoon.Spoon.doubleClickedInTree(Spoon.java:3064) at org.pentaho.di.ui.spoon.Spoon.access$1700(Spoon.java:372) at org.pentaho.di.ui.spoon.Spoon$26.widgetDefaultSelected(Spoon.java:6206) 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) Unknown database 'vincent' at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:583) at org.pentaho.di.core.database.Database.normalConnect(Database.java:456) ... 49 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'vincent' 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:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:871) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1714) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1224) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2190) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2221) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2016) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:776) 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:425) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330) 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) ... 50 more 主機名 : 127.0.0.1 埠 : 3306 資料庫名:vincent

kettle版本8.2,JDK版本1.8.0_261,MYSQL版本8.0.19

問題很明顯,資料庫驅動問題,在遇到這個問題查詢解決方案時,在網上搜索到千篇一律的答案,即在data-integration\lib目錄下放入mysql-connector-java.jar包即可。

一般都能解決大部分人的問題,可以嘗試了N多姿勢就是不行

這裡直接自定義連線即可

把對應版本的java包放到data-integration\lib目錄下

不用加這麼多次引數也行的

簡單的

自定義連線URL(中文換成你的資訊)
jdbc:mysql://IP地址:3306/要連線的資料庫?&serverTimezone=Asia/Shanghai

自定義驅動類名稱:
com.mysql.cj.jdbc.Driver

---

參考

https://lemonlzy.cn/2020/01/07/Kettle-Pentaho-Data-Integration-%E8%BF%9E%E6%8E%A5%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B9%8B%E6%95%B0%E6%8D%AE%E5%BA%93%E9%A9%B1%E5%8A%A8%E5%BC%82%E5%B8%B8/