Oracle ODBC 无 TNS 连接字符串(适用于 64 位 Excel)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26265397/
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
Oracle ODBC TNS-less connection string (for 64-bit Excel)
提问by Josh
Is there a 64-bit Oracle ODBC driver that supports TNS-less connection (or EZ-Connect) convention? I used to use "Microsoft ODBC for Oracle" which allowed a TNS-less connection string, but that has been depreciated for a long time and there is no 64-bit version (i.e. it won't work for 64-bit Office/Excel).
是否有支持无 TNS 连接(或 EZ-Connect)约定的 64 位 Oracle ODBC 驱动程序?我曾经使用“Microsoft ODBC for Oracle”,它允许使用无 TNS 的连接字符串,但它已经贬值了很长时间并且没有 64 位版本(即它不适用于 64 位 Office/Excel )。
I've had the experience that user's in my organization sometimes have a missing or invalid tnsnames.ora file. I want to use a DSN-less connection-string in that does notrequire tnsnames.ora that can be successfully executed on any computer with the proper Oracle drivers installed. This is an example of my old DSN-less, TNS-less connection string that used the depreciated "Microsoft ODBC for Oracle" driver (still works for users on 32-bit office):
我有过这样的经历,我组织中的用户有时会丢失或无效 tnsnames.ora 文件。我想用在一个DSN-less连接字符串并没有要求tnsnames.ora中,可以安装正确的Oracle驱动程序的任何计算机上执行成功。这是我的旧无 DSN、无 TNS 连接字符串的示例,它使用了折旧的“Microsoft ODBC for Oracle”驱动程序(仍然适用于 32 位办公室的用户):
DRIVER={Microsoft ODBC for Oracle}; UID=myun; PWD=mypass;
SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(HOST=myhostname)(PORT=1521))(CONNECT_DATA=(SID=mysid)));
I have been trying to connect with Oracle in OraClient11g_home1ODBC drivers from Oracle but no matter how I try (including EZ_Connect) I can not get it to work without it needing tnsnames.ora, I constantly get this pop-up asking me to specify a service name anyway:
我一直在尝试从 Oracle 的OraClient11g_home1ODBC 驱动程序中与Oracle连接,但无论我如何尝试(包括 EZ_Connect),我都无法在不需要 tnsnames.ora 的情况下使其工作,我不断收到此弹出窗口,要求我指定一个无论如何服务名称:
I have tried using EZ-Connect and many other variations of specifying the Oracle server IP/hostname directly like below but have had no luck:
我曾尝试使用 EZ-Connect 和许多其他直接指定 Oracle 服务器 IP/主机名的变体,如下所示,但没有成功:
Driver={Oracle in OraClient11g_home1};Server=//OracleIPAddress:1521/MySID;
Uid=myUsername;Pwd=myPassword;
采纳答案by Wernfried Domscheit
For the service name you can simply insert the whole TNS-String, e.g. SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1521))(CONNECT_DATA=(SID=mysid)));
对于服务名称,您可以简单地插入整个 TNS-String,例如 SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1521))(CONNECT_DATA=(SID=mysid)));
Enclose it by double quotes and remove any carriage-returns and space charaters.
用双引号将其括起来并删除所有回车符和空格字符。