使用 Widows 创建 Oracle ODBC DSN。输入端口号
我的 c:\Oracle\product\11.1.0\network\ADMIN\TNSNAMES.ORA 文件中有以下条目。
在此处输入代码
pvtest.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxx.xxx.xxx)(PORT = 1521))
)
(CONNECT_DATA =
(SID = pvtest)
(SERVER = DEDICATED)
)
)
我可以使用 TOAD 成功连接。现在,当我尝试创建新的 ODBC DSN 时,它不允许我这样做。如何在 TNS 服务名称中指定端口号?
在此处输入代码
出现以下错误: ------------------------------
测试连接
无法连接 SQL状态=S1000 [Oracle][ODBC][Ora]ORA-12514: TNS: 侦听器当前不知道连接描述符中请求的服务
正常
I have the following entry in my c:\Oracle\product\11.1.0\network\ADMIN\TNSNAMES.ORA file.
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?
enter code here
Get the following error : ---------------------------
Testing Connection
Unable to connect
SQLState=S1000
[Oracle][ODBC][Ora]ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
OK
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当你说可以用TOAD连接时,现在ODBC连接失败了,你还能这样做吗?如果您可以连接客户端 PC 上的任何工具,那么显然另一端的侦听器知道该服务,因此您必须怀疑您的一端。可能一个客户端工具正在尝试在与另一个客户端工具不同的位置访问 PVTEST。
如果一个客户端工具可以连接而另一个客户端工具不能连接,我首先要确认两个客户端都使用相同的 tnsnames.ora 文件。搜索您的客户端并查看是否还有其他 tnsnames.ora 文件,这将暗示其他 ORACLE_HOMES(如果您不知道它是什么,请 Google 一下)。
从命令行执行 TNSPING 并查看它是否到达主机。它还将告诉您连接的详细信息。
在 TOAD 中检查连接详细信息并确保它正在使用 tnsnames 连接,如果是,则检查哪个 tnsnames。
检查您的客户端是否设置了环境变量 TNS_ADMIN。
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.
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).
From a command line do a TNSPING and see if it reaches the host. It will also tell about the connection details.
In TOAD check the connection details and ensure it is using a tnsnames connection and if so which tnsnames.
Check if your client has the environment variable TNS_ADMIN set.
我对 Oracle XE 有这种块:
XE =
(描述=
(地址=(协议= TCP)(主机= test.acme.org)(端口= 1521))
(连接数据=
(服务器=专用)
(服务名称=XE)
)
)
如果将其与您的定义进行比较,则不会发现存在“SERVICE_NAME”参数。
I have this kind of block with Oracle 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.