Java 无法通过 Pentaho 连接到 oracle。找不到“oracle.jdbc.driver.OracleDriver”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20395453/
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
Unable to connect to oracle via Pentaho. 'oracle.jdbc.driver.OracleDriver' could not be found
提问by Joshua1729
Hi I've just installed Pentaho Data Integration v. 5.01 and I'm trying to connect to a database. However, I'm unable to test the connection as I get the error (pasted below).
嗨,我刚刚安装了 Pentaho Data Integration v. 5.01,我正在尝试连接到数据库。但是,我无法测试连接,因为我收到错误(粘贴在下面)。
I have JDK 1.7 installed on the system as well, however I can't seem to locate ojdbc14.jar anywhere.
我在系统上也安装了 JDK 1.7,但是我似乎无法在任何地方找到 ojdbc14.jar。
I downloaded that and pasted it in pentaho's \lib folder but I still get the same error.
我下载了它并将其粘贴到 pentaho 的 \lib 文件夹中,但我仍然遇到相同的错误。
Any solutions to this problem?
这个问题有什么解决方案吗?
Error connecting to database [test] : org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
Driver class 'oracle.jdbc.driver.OracleDriver' could not be found, make sure the 'Oracle' driver (jar file) is installed.
oracle.jdbc.driver.OracleDriver
org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
Driver class 'oracle.jdbc.driver.OracleDriver' could not be found, make sure the 'Oracle' driver (jar file) is installed.
oracle.jdbc.driver.OracleDriver
at org.pentaho.di.core.database.Database.normalConnect(Database.java:415)
at org.pentaho.di.core.database.Database.connect(Database.java:353)
at org.pentaho.di.core.database.Database.connect(Database.java:306)
at org.pentaho.di.core.database.Database.connect(Database.java:294)
at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:84)
at org.pentaho.di.core.database.DatabaseMeta.testConnection(DatabaseMeta.java:2459)
at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:541)
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.SwtButton.access0(SwtButton.java:26)
at org.pentaho.ui.xul.swt.tags.SwtButton.widgetSelected(SwtButton.java:121)
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:375)
at org.pentaho.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:301)
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.doubleClickedInTree(Spoon.java:2885)
at org.pentaho.di.ui.spoon.Spoon.access00(Spoon.java:332)
at org.pentaho.di.ui.spoon.Spoon.widgetDefaultSelected(Spoon.java:5657)
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:1227)
at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:7368)
at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:8673)
at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:625)
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:
Driver class 'oracle.jdbc.driver.OracleDriver' could not be found, make sure the 'Oracle' driver (jar file) is installed.
oracle.jdbc.driver.OracleDriver
at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:474)
at org.pentaho.di.core.database.Database.normalConnect(Database.java:399)
... 45 more
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader.run(Unknown Source)
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 org.pentaho.di.core.database.Database.connectUsingClass(Database.java:467)
... 46 more
采纳答案by Artyom Shalkhakov
Here's my setup. I had this problem and managed to fix it as follows.
这是我的设置。我遇到了这个问题并设法解决了如下问题。
I have SQLDeveloper running on my machine and it works OK, even under VPN. However, I was running Spoon and noticed that it wouldn't work if I use VPN.
我的机器上运行着 SQLDeveloper,即使在 VPN 下也能正常工作。但是,我在运行 Spoon 时注意到,如果我使用 VPN,它就无法工作。
I have tried to put Oracle JDBC drivers shipped with SQLDeveloper into Pentaho. That didn't work.
我曾尝试将 SQLDeveloper 附带的 Oracle JDBC 驱动程序放入 Pentaho。那没有用。
However, I noticed that one big difference between SQLDeveloper and Spoon is that they use different Java runtimes and JDBC Oracle drivers! In particular, my version of SQLDeveloper is running on 32-bit JRE version 1.6.0_11, whereas my system-wide JDK is 64-bit version 1.7.0_03.
但是,我注意到 SQLDeveloper 和 Spoon 之间的一大区别是它们使用不同的 Java 运行时和 JDBC Oracle 驱动程序!特别是,我的 SQLDeveloper 版本在 32 位 JRE 版本 1.6.0_11 上运行,而我的系统范围 JDK 是 64 位版本 1.7.0_03。
I have found the JDBC drivers that SQLDeveloper uses and used them as a replacement for the driver that is shipped with Spoon -- no change.
我找到了 SQLDeveloper 使用的 JDBC 驱动程序,并将它们用作 Spoon 附带的驱动程序的替代品——没有变化。
Then I retargeted Spoon to use the Java runtime used by SQLDeveloper.
然后我重新定位 Spoon 以使用 SQLDeveloper 使用的 Java 运行时。
I set two environment variables: PENTAHO_JAVA and PENTAHO_JAVA_HOME -- and it works OK now!
我设置了两个环境变量:PENTAHO_JAVA 和 PENTAHO_JAVA_HOME -- 现在它可以正常工作了!
For reference, here are my envvars:
作为参考,这是我的 envvars:
PENTAHO_JAVA=C:\opt\sqldeveloper\jdk\jre\bin\java.exe
PENTAHO_JAVA_HOME=c:\opt\sqldeveloper\jdk\jre\
If that is relevant, I am on Windows 7 x64.
如果这是相关的,我在 Windows 7 x64 上。
回答by DGA
try to put ojdbc driver in libext/JDBC in your PDI path (location)
尝试将 ojdbc 驱动程序放在 libext/JDBC 中的 PDI 路径(位置)
回答by user_sk
Try placing the odbc jar file (eg: ojdbc5-11.1.0.7.0.jar) inside the "data-integration/lib" directory of your installation. Don't forget to restart Pentaho to make it work.
尝试将 odbc jar 文件(例如:ojdbc5-11.1.0.7.0.jar)放在安装的“data-integration/ lib”目录中。不要忘记重新启动 Pentaho 使其工作。
回答by user3472048
See, guys we doesn't need all these stuff. We need to paste oracle jdbc driver (ojdbc6.jar) in the following location.
看,伙计们,我们不需要所有这些东西。我们需要在以下位置粘贴oracle jdbc驱动程序(ojdbc6.jar)。
- C:\Program Files\pentaho\design-tools\report-designer\lib\jdbc
- C:\Program Files\pentaho\design-tools\data-integration\lib
- C:\Program Files\pentaho\design-tools\aggregation-designer\lib
- C:\Program Files\pentaho\design-tools\schema-workbench\lib
- C:\Program Files\pentaho\design-tools\report-designer\lib\jdbc
- C:\Program Files\pentaho\design-tools\data-integration\lib
- C:\Program Files\pentaho\design-tools\aggregation-designer\lib
- C:\Program Files\pentaho\design-tools\schema-workbench\lib
回答by Lambert
First go to Oracle Site: http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
Download 1 file: ojdbc6.jar (2,739,670 bytes) - (SHA1 Checksum: a483a046eee2f404d864a6ff5b09dc0e1be3fe6c) Classes for use with JDK 1.6. It contains the JDBC driver classes except classes for NLS support in Oracle Object and Collection types.
Copy it into Pentaho folder: C:\Program Files\Pentaho\data-integration\lib
首先访问 Oracle 站点:http: //www.oracle.com/technetwork/database/features/jdbc/index-091264.html
下载 1 个文件:ojdbc6.jar(2,739,670 字节)-(SHA1 校验和:a483a046eee2f404d864a6ff5b09dc0e1be3fe6c)用于 JDK 1.6 的类。它包含 JDBC 驱动程序类,但 Oracle 对象和集合类型中的 NLS 支持类除外。
将其复制到 Pentaho 文件夹:C:\Program Files\Pentaho\data-integration\lib
That works on my Windows 7 X64 Pro with latest Pentaho 5.3 Stable.
这适用于我的带有最新 Pentaho 5.3 Stable 的 Windows 7 X64 Pro。
回答by Marcel Fernandez
In Pentaho version 6.0 put the driver (ojdbc6.jar) in: "PentahoInstallation"\design-tools\data-integration\lib and restart the Data Integration ide.
在 Pentaho 6.0 版中,将驱动程序 (ojdbc6.jar) 放入:“PentahoInstallation”\design-tools\data-integration\lib 并重新启动 Data Integration ide。
回答by Thomas Decaux
Try putting the jar on tomcat library folder, then restart Pentaho.
尝试将 jar 放在 tomcat 库文件夹中,然后重新启动 Pentaho。
Should be here .../biserver-ce-6.0.0.0-353/biserver-ce/tomcat/lib
应该在这里 .../biserver-ce-6.0.0.0-353/biserver-ce/tomcat/lib
There are already some drivers here.
这里已经有一些司机了。
回答by DJ6968
I could solve this issue by selecting Oralce Native connection > Hostname as Ip address of DB server > instead of SN00XXXX I had used DB00XXX name for the Database name.
我可以通过选择 Oralce Native connection > Hostname as Ip address of DB server > 而不是 SN00XXXX 来解决这个问题,我使用 DB00XXX 名称作为数据库名称。
I hope this works for such issues with oracle connectivity.
我希望这适用于 oracle 连接的此类问题。