Oracle SQL Developer - JDBC 驱动程序问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42437635/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:23:41  来源:igfitidea点击:

Oracle SQL Developer - Issue with JDBC Driver

oraclejdbcoracle-sqldeveloperwindows-7-x64

提问by Tiago

I've:

我有:

  • Windows 7 x64
  • My 11G Oracle client as per below C:\Oracle\product\11.2.0\client_1
  • My SQL Developer (downloaded the kit with JDK 8 included, but installed the JSK separately just in case) dir as per below C:\sqldeveloper
  • 视窗 7 x64
  • 我的 11G Oracle 客户端如下 C:\Oracle\product\11.2.0\client_1
  • 我的 SQL Developer(下载了包含 JDK 8 的工具包,但为了以防万一,单独安装了 JSK)目录如下 C:\sqldeveloper

When I try to connect using TNS I have

当我尝试使用 TNS 连接时,我有

no ocijdbc12 in java.library.path

java.library.path 中没有 ocijdbc12

If I go to Settings -> Database -> Advanced and choose my Oracle dir manually I get this:

如果我转到 Settings -> Database -> Advanced 并手动选择我的 Oracle 目录,我会得到以下信息:

Testing the Oracle Home located at C:\Oracle\product\11.2.0\client_1 Testing client directory ... OK Testing loading Oracle JDBC driver ... OK Testing checking Oracle JDBC driver version ... Failed: Minimum driver version 11.2.0.3 required, specified driver version is 11.2.0.1.0

测试位于 C:\Oracle\product\11.2.0\client_1 的 Oracle Home 测试客户端目录 ... OK 测试加载 Oracle JDBC 驱动程序 ... OK 测试检查 Oracle JDBC 驱动程序版本 ...失败:最低驱动程序版本 11.2。需要 0.3,指定驱动版本为 11.2.0.1.0

So I looked into upgrading the JDBC driver, but I can't use the check for updates feature, since it appears to be blocked in my virtual machine.

所以我考虑升级 JDBC 驱动程序,但我无法使用检查更新功能,因为它似乎在我的虚拟机中被阻止。

I got the ojdbc7.jar from the SQL developer directory and copied it to C:\Oracle\product\11.2.0\client_1\jdbc\lib, and now I get the error below:

我从SQL developer目录中得到ojdbc7.jar,复制到C:\Oracle\product\11.2.0\client_1\jdbc\lib,现在出现如下错误:

Testing the Oracle Home located at C:\Oracle\product\11.2.0\client_1 Testing client directory ... OK Testing loading Oracle JDBC driver ... OK Testing checking Oracle JDBC driver version ... OK Driver version: 12.1.0.2.0 Testing testing native OCI library load ...

Failed: Error loading the native OCI library The native OCI driver could not be loaded. The system propertyjava.library.path contains the entries from the environment variable PATH. Check it to verify that
the expected native library directory

C:\Oracle\product\11.2.0\client_1\bin is present and precedes any other client installations. java.library.path = C:\sqldeveloper\jdk\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Oracle\product\10.2.0\client_1\bin;C:\Oracle\product\11.2.0\client_1\bin;C:\Oracle\product\11.2.0\client_2;C:\Oracle\product\11.2.0\client_2\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ARQDISP\;C:\Program ;.

测试位于 C:\Oracle\product\11.2.0\client_1 的 Oracle Home 测试客户端目录 ... OK 测试加载 Oracle JDBC 驱动程序 ... OK 测试检查 Oracle JDBC 驱动程序版本 ... OK 驱动程序版本:12.1.0.2 .0 测试本机 OCI 库负载...

失败:加载本机 OCI 库时出错 无法加载本机 OCI 驱动程序。系统属性java.library.path 包含来自环境变量PATH 的条目。检查它以验证
预期的本机库目录

C:\Oracle\product\11.2.0\client_1\bin 存在并且在任何其他客户端安装之前。java.library.path = C:\sqldeveloper\jdk\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Oracle\product\10.2.0 \client_1\bin;C:\Oracle\product\11.2.0\client_1\bin;C:\Oracle\product\11.2.0\client_2;C:\Oracle\product\11.2.0\client_2\bin;C: \Windows\system32;C:\Windows;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ARQDISP\;C:\Program ;.

Have no idea what I'm doing at this point. Could you please help?

不知道此时我在做什么。能否请你帮忙?

回答by Rajesh Goel

Its missing drivers. So in my case I installed Oracle Client from http://www.oracle.com/technetwork/topics/winx64soft-089540.htmland set the path variable accordingly.

它缺少的驱动程序。因此,就我而言,我从http://www.oracle.com/technetwork/topics/winx64soft-089540.html安装了 Oracle 客户端, 并相应地设置了路径变量。

Here's a blog post that shows how to tell SQL Developer where and which installed client to use :

这是一篇博客文章,展示了如何告诉 SQL Developer 在哪里以及使用哪个安装的客户端:

https://www.thatjeffsmith.com/archive/2014/01/oracle-sql-developer-4-and-the-oracle-client/

https://www.thatjeffsmith.com/archive/2014/01/oracle-sql-developer-4-and-the-oracle-client/

Restart your SQL Developer.

重新启动您的 SQL Developer。

回答by uday mallam

For database selecting the connection properties and changing the connection type from TNS to Basic and providing the other details (Service name/SID) for the connection resolved the issue for me

对于数据库,选择连接属性并将连接类型从 TNS 更改为 Basic 并提供连接的其他详细信息(服务名称/SID)为我解决了这个问题

回答by D. Lohrstr?ter

Maybe it helps having a look into answer of my post about similar topic:

也许它有助于查看我关于类似主题的帖子的答案:

How to get Sqldeveloper 19.1 64-bit working with instantclient_12_2 on Windows enterprise PC without admin privileges?

如何让Sqldeveloper 19.1 64位在没有管理员权限的Windows企业PC上使用instantclient_12_2?

The mentioned .bat file shows all you need. If you have admin privileges or permissions to change any environment variables, then it will probably be the better way without using .bat file.

提到的 .bat 文件显示了您需要的所有内容。如果您具有更改任何环境变量的管理员权限或权限,那么不使用 .bat 文件可能是更好的方法。

回答by Piotr Kepka

When I try to connect using TNS I have

no ocijdbc12 in java.library.path

当我尝试使用 TNS 连接时,我有

java.library.path 中没有 ocijdbc12

It is so stupid and funny, at the same time, what I found.

同时,我的发现是如此愚蠢和有趣。

I get the same error and the only difference between when it is OK and when is not is...

我得到了同样的错误,唯一的区别是什么时候可以,什么时候不是......

the TNS definition in tnsnames.ora

Simply add (maybe once again if it disappeared) the TNS definition of your database, like:

只需添加(如果它消失了,可能再添加一次)数据库的 TNS 定义,例如:

XE.WORLD=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=localhost)
      (PORT=1521)
    )
    (CONNECT_DATA=
      (SERVICE_NAME=XE.WORLD)
      (SERVER = DEDICATED)
    )
  )

and restart SQL Developer.

并重新启动 SQL Developer。

Connection configuration will keep the name (XE.WORLD) even if it is already gone from tnsnames.ora. If it is not there, on the connection attempt, it will return that misleading error.

连接配置将保留名称 (XE.WORLD),即使它已经从 tnsnames.ora 中消失。如果它不存在,则在连接尝试时,它将返回该误导性错误。

My setup: SQL Developer 4.1.4.21, ojdbc8.jar, connection to Oracle 19c.

我的设置:SQL Developer 4.1.4.21,ojdbc8.jar,连接到 Oracle 19c。

回答by beakerchi

I had similar issue. Moving from sqldeveloper 4.0 to 4.1, imported all my connections, but in 4.1, I would get 'no ocijdbc12 in java.library.path'. I opened up my current connections (right-click on any connection and choose properties) all of which the connection Type is TNS.
The 'Connect Identifier' was checked with the connections network alias name entered there.
I checked on the 'Network Alias' check box and selected the same name and then the connection worked.
I went back to 4.0 to examine my connections there and it appears that the alias name works fine with the 'Connect Identifier' selected but not in 4.1 I had to update all my many connections to use 'Network Alias'.

我有类似的问题。从 sqldeveloper 4.0 移动到 4.1,导入了我的所有连接,但在 4.1 中,我会得到“java.library.path 中没有 ocijdbc12”。我打开了我当前的连接(右键单击任何连接并选择属性),所有这些连接类型都是 TNS。
'Connect Identifier' 与在那里输入的连接网络别名进行了检查。
我选中了“网络别名”复选框并选择了相同的名称,然后连接正常工作。
我回到 4.0 以检查我在那里的连接,似乎别名在选择了“连接标识符”的情况下工作正常,但在 4.1 中却没有,我必须更新我所有的许多连接以使用“网络别名”。

回答by wassy_bujy

Error loading the native OCI libraryThe native OCI driver could not be loaded and when trying to connect to a database i was getting no ocijdbc12 in java.library.path

加载本机 OCI 库时出错无法加载本机 OCI 驱动程序,并且在尝试连接到数据库时,我在 java.library.path 中找不到 ocijdbc12

For me the error was solved after i have created a new variable ORACLE_HOME with the value ....(path of the folder where the sql developer was insataled)\jdk\jre. Then i have added at the begging of the Path variable %ORACLE_HOME%\bin.

对我来说,在我创建了一个新变量 ORACLE_HOME 后,该错误得到了解决,其值为 ....(安装 sql 开发人员的文件夹的路径)\jdk\jre。然后我添加了 Path 变量%ORACLE_HOME%\bin的乞求。

At first i have created a system variable that was pointing to the folder of the installation of the dev express and that was not working

起初,我创建了一个系统变量,该变量指向 dev express 的安装文件夹,但它不起作用