从 Excel 访问 Oracle 数据库:ODBC 出错
Access Oracle Database from Excel: Error with ODBC
我正在尝试将数据从 Oracle 导入到 Excel。我希望在获取数据下的下拉列表中找到 Oracle DB,如在线所示:
那张图片不在那里 我点击 documentation 解释我应该安装 32 位 Oracle 数据访问组件 (ODAC) 和 Oracle 开发人员工具 Visual Studio (12.1. 0.2.4).
这样做之后,我看不到下拉菜单。但是,我读到 elsewhere 可以从其他来源 > 从 OBDC 访问它:
我查看了 Windows 管理工具 > ODBC 数据源管理器,并在其中添加了一个新的 Microsoft ODBC for Oracle 安装程序。
我的数据库现在出现在 ODBC 数据库选择下拉列表中。我要求查询并且...我收到两个错误:
首先是 Windows 错误:
"The Oracle(tm) client and networking components were not found.
Thesec components are supplied by Oracle Corportation and are part of
the Oracle Version 7.3 (or greater) client software installation. You
will be unable to use these drivers until these components have been
installed"
然后电源查询错误:
"ODBC: ERROR [IM004] [Microsoft][ODBC Driver Manager] Driver's
SQLAllocHandle on SQL_HANDLE_ENV failed"
所以现在我有点困惑,不明白这意味着什么以及我做错了什么。这里的其他帖子没有指出正确的方向(我认为)。
您应该将 Oracle 主目录(安装 32 位 Oracle 数据访问组件的路径)添加到您的 PATH 系统变量中。您需要 oracle_home 和 oracle_home\bin 的条目,即您的安装路径是 c:\oracle\client12 然后将 PATH=c:\oracle\client12;c:\oracle\client12\bin;c:\windows\system32....
添加到路径变量。在大多数情况下,PC 需要在更改路径后重新启动。
您使用驱动程序 "Microsoft ODBC for Oracle" 添加了一个 ODBC-DSN。此 odbc 驱动程序已弃用。您应该在 odbc 对话框中使用名为 "Oracle in ...." 的本机 oracle 驱动程序。
使用的 Oracle Home 需要一个 tnsnames.ora 文件(或其他 tns 解析方法,如 onames、ip)来将 tnsalias 解析为数据库服务或 sid。该文件位于子目录 network\admin
中的 Oracle Home 路径中。示例 tnsnames.ora:
orcl.example.com =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myserver.example.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
tnsalias orcl.example.com
解析为 myserver.example.com
,侦听器端口 1521
。连接的数据库服务是 orcl
.
此 tnsalias 用于定义 ODBC 数据源名称:
如果下拉框没有值,您可以用您定义的 tnsalias 覆盖该框。在示例中 orcl.example.com
我成功连接到 Oracle 数据库。
我必须安装一些先决条件,即 Microsoft Visual C++ Redistributable 软件包 x_64 和 x_86.
我遵循了本文档中的步骤:https://manjaro.site/how-to-install-oracle-odbc-driver-on-windows-10/
它就像一个魅力,我也可以连接到 MySql 作为奖励。
我正在尝试将数据从 Oracle 导入到 Excel。我希望在获取数据下的下拉列表中找到 Oracle DB,如在线所示:
那张图片不在那里 我点击 documentation 解释我应该安装 32 位 Oracle 数据访问组件 (ODAC) 和 Oracle 开发人员工具 Visual Studio (12.1. 0.2.4).
这样做之后,我看不到下拉菜单。但是,我读到 elsewhere 可以从其他来源 > 从 OBDC 访问它:
我查看了 Windows 管理工具 > ODBC 数据源管理器,并在其中添加了一个新的 Microsoft ODBC for Oracle 安装程序。
我的数据库现在出现在 ODBC 数据库选择下拉列表中。我要求查询并且...我收到两个错误:
首先是 Windows 错误:
"The Oracle(tm) client and networking components were not found. Thesec components are supplied by Oracle Corportation and are part of the Oracle Version 7.3 (or greater) client software installation. You will be unable to use these drivers until these components have been installed"
然后电源查询错误:
"ODBC: ERROR [IM004] [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed"
所以现在我有点困惑,不明白这意味着什么以及我做错了什么。这里的其他帖子没有指出正确的方向(我认为)。
您应该将 Oracle 主目录(安装 32 位 Oracle 数据访问组件的路径)添加到您的 PATH 系统变量中。您需要 oracle_home 和 oracle_home\bin 的条目,即您的安装路径是 c:\oracle\client12 然后将 PATH=c:\oracle\client12;c:\oracle\client12\bin;c:\windows\system32....
添加到路径变量。在大多数情况下,PC 需要在更改路径后重新启动。
您使用驱动程序 "Microsoft ODBC for Oracle" 添加了一个 ODBC-DSN。此 odbc 驱动程序已弃用。您应该在 odbc 对话框中使用名为 "Oracle in ...." 的本机 oracle 驱动程序。
使用的 Oracle Home 需要一个 tnsnames.ora 文件(或其他 tns 解析方法,如 onames、ip)来将 tnsalias 解析为数据库服务或 sid。该文件位于子目录 network\admin
中的 Oracle Home 路径中。示例 tnsnames.ora:
orcl.example.com =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myserver.example.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
tnsalias orcl.example.com
解析为 myserver.example.com
,侦听器端口 1521
。连接的数据库服务是 orcl
.
此 tnsalias 用于定义 ODBC 数据源名称:
如果下拉框没有值,您可以用您定义的 tnsalias 覆盖该框。在示例中 orcl.example.com
我成功连接到 Oracle 数据库。
我必须安装一些先决条件,即 Microsoft Visual C++ Redistributable 软件包 x_64 和 x_86.
我遵循了本文档中的步骤:https://manjaro.site/how-to-install-oracle-odbc-driver-on-windows-10/
它就像一个魅力,我也可以连接到 MySql 作为奖励。