MySQL Pentaho 数据集成 SQL 连接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11634181/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Pentaho Data Integration SQL connection
提问by user979331
I am using Pentaho Data Integration and I am trying to connect to my database via MySQL but when I do I get this error.....
我正在使用 Pentaho Data Integration 并且我正在尝试通过 MySQL 连接到我的数据库,但是当我这样做时我收到此错误.....
Error connecting to database [devdb2] : org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
Exception while loading class
org.gjt.mm.mysql.Driver
org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
Exception while loading class
org.gjt.mm.mysql.Driver
at org.pentaho.di.core.database.Database.normalConnect(Database.java:368)
at org.pentaho.di.core.database.Database.connect(Database.java:317)
at org.pentaho.di.core.database.Database.connect(Database.java:279)
at org.pentaho.di.core.database.Database.connect(Database.java:269)
at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:86)
at org.pentaho.di.core.database.DatabaseMeta.testConnection(DatabaseMeta.java:2464)
at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:533)
at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:329)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:139)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:123)
at org.pentaho.ui.xul.swt.tags.SwtButton.access0(SwtButton.java:26)
at org.pentaho.ui.xul.swt.tags.SwtButton.widgetSelected(SwtButton.java:119)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.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.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:378)
at org.pentaho.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:304)
at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:115)
at org.pentaho.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:62)
at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.newConnection(SpoonDBDelegate.java:493)
at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.newConnection(SpoonDBDelegate.java:478)
at org.pentaho.di.ui.spoon.Spoon.newConnection(Spoon.java:7770)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:329)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:139)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:123)
at org.pentaho.ui.xul.swt.tags.SwtMenuitem.access0(SwtMenuitem.java:27)
at org.pentaho.ui.xul.swt.tags.SwtMenuitem.widgetSelected(SwtMenuitem.java:77)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.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:1183)
at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:6966)
at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:567)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.pentaho.commons.launcher.Launcher.main(Launcher.java:134)
Caused by: org.pentaho.di.core.exception.KettleDatabaseException:
Exception while loading class
org.gjt.mm.mysql.Driver
at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:423)
at org.pentaho.di.core.database.Database.normalConnect(Database.java:352)
... 50 more
Caused by: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at java.net.URLClassLoader.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:414)
... 51 more
If I used SQLite as my Connection Type it works but no data is returned when I goto explore it. So my question is how do I get MySQL working or get the data using SQLite?
如果我使用 SQLite 作为我的连接类型,它可以工作,但在我探索它时没有返回任何数据。所以我的问题是如何让 MySQL 工作或使用 SQLite 获取数据?
Am I missing a library or a class?
我错过了图书馆或课程吗?
采纳答案by user979331
Turns out I will missing a class called mysql-connector-java-5.1.2.jar, I added it this folder (C:\Program Files\pentaho\design-tools\data-integration\lib) and it worked with a MySQL connection and my data and tables appear.
结果我会丢失一个名为 mysql-connector-java-5.1.2.jar 的类,我将它添加到这个文件夹 (C:\Program Files\pentaho\design-tools\data-integration\lib) 并且它与 MySQL 一起工作连接和我的数据和表格出现。
回答by nelsonic
I just came across the same issue while trying to query a MySQL Database from Pentaho.
我在尝试从 Pentaho 查询 MySQL 数据库时遇到了同样的问题。
Error connecting to database [Local MySQL DB] : org.pentaho.di.core.exception.KettleDatabaseException: Error occured while trying to connect to the database
Exception while loading class org.gjt.mm.mysql.Driver
连接到数据库 [Local MySQL DB] 时出错:org.pentaho.di.core.exception.KettleDatabaseException:尝试连接到数据库时发生错误
加载类 org.gjt.mm.mysql.Driver 时出现异常
Expanding post by @user979331 the solution is:
由@user979331 扩展帖子,解决方案是:
- Downloadthe MySQL Java Connector / Driverthat is compatible with your kettle version
- Unzipthe zipfile (in my case it was mysql-connector-java-5.1.31.zip)
copythe .jarfile (mysql-connector-java-5.1.31-bin.jar) and pasteit in your Libfolder:
PC:C:\Program Files\pentaho\design-tools\data-integration\lib
Mac:/Applications/data-integration/lib
- 下载与您的水壶版本兼容的MySQL Java 连接器/驱动程序
- 解压的压缩文件(在我的情况下,它是mysql-connector-java-5.1.31.zip)
复制的的.jar文件(使用mysql-connector-java的5.1.31-bin.jar),并粘贴在你的库文件夹:
PC:C:\Program Files\pentaho\design-tools\data-integration\lib
Mac:/Applications/data-integration/lib
Restart Pentaho (Data Integration) and re-test the MySQL Connection.
重新启动 Pentaho(数据集成)并重新测试 MySQL 连接。
Additional interesting repliesfrom others that could also help:
其他人的其他有趣回复也可能有所帮助:
- think to download the good JDBC driver version, compatible with your PDI version: https://help.pentaho.com/Documentation/8.1/Setup/JDBC_Drivers_Reference#MY_SQL
- take the zip version ("platform independant") to extract the jar file
- take into lib folder
- see also proper way to handle it proposed by Ryan Tuck
- 想下载好的JDBC驱动版本,与你的PDI版本兼容:https: //help.pentaho.com/Documentation/8.1/Setup/JDBC_Drivers_Reference#MY_SQL
- 使用 zip 版本(“平台无关”)来提取 jar 文件
- 进入lib文件夹
- 另请参阅 Ryan Tuck 提出的处理它的正确方法
回答by FremenFreedom
Missing driver file.
缺少驱动程序文件。
This error is really common for people just getting started with PDI.
对于刚开始使用 PDI 的人来说,这个错误真的很常见。
Drivers go in \pentaho\design-tools\data-integration\libext\JDBC for PDI. If you are using other tools in the Pentaho suite, you may need to copy drivers to additional locations for those tools. For reference, here are the appropriate folders for some of the other design tools:
驱动程序进入\pentaho\design-tools\data-integration\libext\JDBC for PDI。如果您正在使用 Pentaho 套件中的其他工具,您可能需要将驱动程序复制到这些工具的其他位置。作为参考,以下是一些其他设计工具的相应文件夹:
- Aggregation Designer: \pentaho\design-tools\aggregation-designer\drivers
- Metadata Editor: \pentaho\design-tools\metadata-editor\libext\JDBC
- Report Designer: \pentaho\design-tools\report-designer\lib\jdbc
- Schema Workbench: \pentaho\design-tools\schema-workbench\drivers
- 聚合设计器:\pentaho\design-tools\aggregation-designer\drivers
- 元数据编辑器:\pentaho\design-tools\metadata-editor\libext\JDBC
- 报表设计器:\pentaho\design-tools\report-designer\lib\jdbc
- 架构工作台:\pentaho\design-tools\schema-workbench\drivers
If this transformation or job will run on another box, such as a test or production server, don't forget to include copying the jar file and restarting PDI or the Data Integration Server in your deployment considerations.
如果此转换或作业将在另一个机器上运行,例如测试或生产服务器,请不要忘记在部署注意事项中包括复制 jar 文件和重新启动 PDI 或数据集成服务器。
回答by Dean Schulze
You need to download mysql-connector-java-5.1.46.tar.gz
, not the latest version. The Driver class that Pentaho uses is not included in mysql-connector-java-8.xx.yy versions.
您需要下载mysql-connector-java-5.1.46.tar.gz
,而不是最新版本。Pentaho 使用的 Driver 类不包含在 mysql-connector-java-8.xx.yy 版本中。
回答by Ryan Tuck
In addition to the other answers here, here's how you can do it on Ubuntu (14.04):
除了此处的其他答案外,您还可以在 Ubuntu (14.04) 上执行以下操作:
sudo apt-get install libmysql-java
sudo apt-get install libmysql-java
this will download mysql-connector-java-5.x.x.jar
to /usr/share/java/
, which i believe also automatically creates a symlink named mysql-connector-java.jar
.
这将下载mysql-connector-java-5.x.x.jar
到/usr/share/java/
,我相信它也会自动创建一个名为mysql-connector-java.jar
.
Then, create a symlink in /your/path/to/data-integration/lib/
:
然后,在 中创建一个符号链接/your/path/to/data-integration/lib/
:
ln -s /usr/share/java/mysql-connector-java.jar /your/path/to/data-integration/lib/mysql-connector-java.jar
ln -s /usr/share/java/mysql-connector-java.jar /your/path/to/data-integration/lib/mysql-connector-java.jar
回答by Shubham Chopra
Above answers were helpful, but for unknown reasons they did not seem to work. So if you have already installed MySql workbench on your system, instead of downloading the jar files and struggling with the correct version just go to
以上答案很有帮助,但由于未知原因,它们似乎不起作用。所以如果你已经在你的系统上安装了 MySql 工作台,而不是下载 jar 文件并努力使用正确的版本,只需转到
C:\Program Files (x86)\MySQL\Connector J 8.0
and copy mysql-connector-java-8.0.12
(does not matter what version it is) the jar file in that location and paste it to C:\Program Files\pentaho\design-tools\data-integration\lib
并复制mysql-connector-java-8.0.12
(不管它是什么版本)该位置的 jar 文件并将其粘贴到C:\Program Files\pentaho\design-tools\data-integration\lib
回答by PKP
First of all you need to download Mysql connector which is compatible with your pentaho version.after that paste it to data-integration/libfolder and restart your pentaho. check this https://help.pentaho.com/Documentation/8.1/Setup/JDBC_Drivers_Reference#MY_SQL
首先,您需要下载与您的 pentaho 版本兼容的 Mysql 连接器。然后将其粘贴到data-integration/lib文件夹并重新启动您的 pentaho。检查这个 https://help.pentaho.com/Documentation/8.1/Setup/JDBC_Drivers_Reference#MY_SQL
回答by h4mz4
At the present time, there is a simple way to fix this problem:
目前,有一个简单的方法可以解决这个问题:
- Go to
Tools
→MarketPlace
and search for "PDI MySQL Plugin" - Install it ( this will automatically install the missing driver here:
data-integration\plugins\databases\pdi-mysql-plugin\lib
) - Restart Pentaho
- Done.
- 转到
Tools
→MarketPlace
并搜索“PDI MySQL 插件” - 安装它(这将自动在此处安装缺少的驱动程序:
data-integration\plugins\databases\pdi-mysql-plugin\lib
) - 重启 Pentaho
- 完毕。