windows 使用 Widows 创建 Oracle ODBC DSN。输入端口号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4517230/
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
Create a Oracle ODBC DSN with Widows. Entering the port number
提问by Priyaranjan Anand Marathe
I have the following entry in my c:\Oracle\product\11.1.0\network\ADMIN\TNSNAMES.ORA file.
我的 c:\Oracle\product\11.1.0\network\ADMIN\TNSNAMES.ORA 文件中有以下条目。
enter code here
pvtest.world =
enter code here
pvtest.world =
(DESCRIPTION =
(描述 =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxx.xxx.xxx)(PORT = 1521))
)
(CONNECT_DATA =
(SID = pvtest)
(SERVER = DEDICATED)
)
)
)
I could connect successfully using TOAD. Now when I try creating a new ODBC DSN it doesn't allow me to do so. How do I specify the port number in TNS Service Name?
我可以使用 TOAD 成功连接。现在,当我尝试创建新的 ODBC DSN 时,它不允许我这样做。如何在 TNS 服务名称中指定端口号?
enter code here
Get the following error : ---------------------------
enter code here
得到以下错误:---------------------------
Testing Connection
测试连接
Unable to connect SQLState=S1000 [Oracle][ODBC][Ora]ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
无法连接 SQLState=S1000 [Oracle][ODBC][Ora]ORA-12514: TNS:listener 当前不知道连接描述符中请求的服务
OK
好的
回答by Karl
When you say you could connect with TOAD, can you do so now that the ODBC connection fails? if you can connect with any tool on your client PC than obviously the listener at the other end knows of the service so you have to suspect your end. Probably one client tool is trying to reach PVTEST at a diffrerent location than the other.
当您说您可以使用 TOAD 连接时,您现在可以在 ODBC 连接失败的情况下这样做吗?如果您可以连接客户端 PC 上的任何工具,那么显然另一端的侦听器知道该服务,因此您必须怀疑自己的端。可能一个客户端工具正试图在与另一个不同的位置访问 PVTEST。
If one client tool can connect and the other cannot, first of I would confirm that both clients are using the same tnsnames.ora file. Search your client and see if there are other tnsnames.ora files which would imply other ORACLE_HOMES (Google that if you don't know what it is).
如果一个客户端工具可以连接而另一个不能连接,首先我会确认两个客户端都使用相同的 tnsnames.ora 文件。搜索您的客户端,看看是否有其他 tnsnames.ora 文件暗示其他 ORACLE_HOMES(如果您不知道它是什么,请谷歌一下)。
From a command line do a TNSPING and see if it reaches the host. It will also tell about the connection details.
从命令行执行 TNSPING 并查看它是否到达主机。它还将讲述连接详细信息。
In TOAD check the connection details and ensure it is using a tnsnames connection and if so which tnsnames.
在 TOAD 中检查连接详细信息并确保它使用的是 tnsnames 连接,如果是,则使用哪个 tnsnames。
Check if your client has the environment variable TNS_ADMIN set.
检查您的客户端是否设置了环境变量 TNS_ADMIN。
回答by Gato3
I have this kind of block with Oracle XE:
我在 Oracle XE 中有这种块:
XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test.acme.org)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) )
XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test.acme.org)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)) )
If you compare that with yours definition, not that there is "SERVICE_NAME" parameter.
如果您将其与您的定义进行比较,则不是有“SERVICE_NAME”参数。