软件环境
本文使用的软件版本为:
- Windows 10 专业版 64 位(10.0,版本 10586)
- Navicat Premium 11.0.18 (x64)
- instantclient-basic-windows.x64-12.2.0.1.0
- vcredist_x64.exe (Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.40660)
直接使用 Navicat 连接 Oracle 出现的问题
在安装完 Navicat 之后,创建 Oracle 数据库连接,但发现无法连接到数据库:
出现上述错误的缘故原由,可能是 Navicat 自带的 Oracle Instant Client 与我们要连接的 Oracle 数据库版本不匹配导致的。
查察 Navicat 所使用的 Oracle Instant Client 版本
点击 Navicat 菜单栏的
复制代码 →复制代码 →复制代码 →复制代码 ,通过 OCI library (oci.dll) * 可知当前 Navicat 所使用的 Instant Client 版本:
查察 Navicat 的安装目次,我们会发现 Navicat Premium 11.0.18 自带的 Instant Client 版本为 10.2:
查察 Oracle 版本
我们再来查察下所要连接的 Oracle 数据库版本:
到此为止,我们知道了现在我们所使用的 Oracle 版本和 Instant Client 版本,接下来我们来查抄下他们两个版本是否匹配。
查抄 Oracle 和 Instant Client 版本是否匹配
打开Oracle Instant Client 官网:
点击 Downloads,打开 Instant Client 下载页:
由于我使用的是 64 位操纵体系,故选择 Instant Client for Microsoft Windows (x64):
由于我们肯定是要下载 Instant Client 的,故在此先勾选接受允许协议(Accept License Agreement)。
并且通过本页面,我们知道了 Instant Client 18.3 版本可以连接到 Oracle 11.2 及以后的版本(第二个红框处),但我们先忽略这里,直接来到该页底部:
我们发现 18.3 和 12.2 版本的 Instant Client 都是可以连接 Oracle 11.2 的(我们所要连接的 Oracle 版本),并且 18.3 和 12.2 版本的 Instant Client 还必要 Visual Studio 2013 redistributable 才可运行,故我们分别下载这两个软件。
下载 Instant Client 12.2 和 Visual Studio 2013 (VC++ 12.0)
这里我下载的是 Instant Client 12.2:
然后,下载Visual Studio 2013 (VC++ 12.0):
配置 Navicat
我们可以将 instantclient-basic-windows.x64-12.2.0.1.0.zip 解压至任意目次,好比- C:\Portable\instantclient_12_2
复制代码
,然后在 Navicat 中配置此版本的 OCI:
配置完 OCI 后,必要重启 Navicat,然后再次连接 Oracle 数据库:
这时,我们发现 Navicat 又报错了,提示 Cannot load OCI DLL, 126…。
这是由于环境中缺少 Visual Studio 2013 redistributable 所致的。
安装 Visual Studio 2013 redistributable:
到此为止,我们即可使用 Navicat 精确连接到 Oracle 数据库了。
到此这篇关于使用Navicat Premium连接Oracle的方法步调的文章就先容到这了,更多相关Navicat Premium连接Oracle内容请搜索脚本之家以前的文章或继承欣赏下面的相关文章盼望大家以后多多支持脚本之家! |