Oracle (0x80004005)ORA-12154: TNS: 无法解析连接标识符

我正在尝试从 ASP 经典应用程序连接到 Oracle 数据库,但是我一直遇到 ORA-12154 错误.

I'm trying to connect to an oracle db from an ASP classic application, however I keep running into the ORA-12154 error.

  1. TNSNAMES.ORA 配置正确

  1. TNSNAMES.ORA is configured properly

DBSOURCE.A.B.com =(描述=(地址列表 =(地址 = (协议 = TCP)(主机 = C.D.B.com)(端口 = 1231)))(连接数据 =(SERVICE_NAME = DBSOURCE)))

DBSOURCE.A.B.com = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = C.D.B.com)(PORT = 1231)) ) (CONNECT_DATA = (SERVICE_NAME = DBSOURCE) ) )

我可以 TNSPING

I can TNSPING

C:Documents and SettingsUSERID.A>tnsping DBSOURCE

C:Documents and SettingsUSERID.A>tnsping DBSOURCE

适用于 32 位 Windows 的 TNS Ping 实用程序:版本 10.2.0.4.0 - 2 月 9 日生产011 09:12:31

TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 09-MAR-2 011 09:12:31

版权所有 (c) 1997、2007、甲骨文.保留所有权利.

Copyright (c) 1997, 2007, Oracle. All rights reserved.

使用的参数文件:C:oracleproduct10.2.0client_1NETWORKADMINsqlnet.ora

Used parameter files: C:oracleproduct10.2.0client_1NETWORKADMINsqlnet.ora

使用 TNSNAMES 适配器解析别名尝试联系 (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = C.D.B.com)(PORT = 1231))) (CONNECT_DATA = (SERVIC)E_NAME = DBSOURCE)))正常(30 毫秒)

Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = C.D.B.com)(PORT = 1231))) (CONNECT_DATA = (SERVIC E_NAME = DBSOURCE))) OK (30 msec)

我可以创建一个 ODBC 连接,并且我已经测试了成功的连接.

I can create an ODBC connection and I've tested the connection which is successful.

我检查了我的 sqlnet.ora 文件

I've checked my sqlnet.ora file

NAMES.DEFAULT_DOMAIN = A.B.com

NAMES.DEFAULT_DOMAIN = A.B.com

SQLNET.AUTHENTICATION_SERVICES=(无)

SQLNET.AUTHENTICATION_SERVICES= (NONE)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

我还检查了 TNSNAMES.ORA 作为我的系统路径之一.

I've also checked that the TNSNAMES.ORA as one of my system paths.

我可以使用 SQLPLUS 连接到数据库

I can connect to the DB with SQLPLUS

这是引发错误的代码

dim CnnStr

Set Cnn = Server.CreateObject("ADODB.Connection")

CnnStr="Provider=MSDAORA.1;Password=pass;User ID=user;Data Source=DBSOURCE"

Cnn.Open CnnStr

我正在运行 windows XP Pro 32bit SP3

I am running windows XP Pro 32bit SP3

我在同事的机器上测试过了,asp 应用没有问题,是我在某处遗漏了配置还是搞砸了我的配置?

I've tested this on a co-workers machine and the asp app has no issues, am I missing a configuration somewhere or did I mess up my config?

感谢大家的帮助!

推荐答案

似乎所有设置都已检查,但这里是我的一些故障排除建议:

It seems all the settings have been checked but here is my suggestions for some trouble shooting:

  • 如何限制 IIS 运行的帐户?它是否具有读取 TNSNAMES 的文件权限?您是否尝试过赋予用户更多权限.甚至使用本地系统帐户运行 IIS?记得把它放回原来的样子.
  • 您确定没有可能影响/阻止访问的第三方应用程序,例如防病毒或防火墙.(禁用它们进行测试,但不要忘记重新启用 :)

(你最后做了什么来解决它?)

(What did you finally do to solve it?)

相关文章