远程ORACLE服务器连接字符串

发布于 2024-12-19 00:04:20 字数 649 浏览 3 评论 0原文

我有一台 winxp 远程 Oracle 服务器和一台带有 IIS 的 Windows 7 计算机。

我将在 win7 计算机上托管一个站点,从我的 winxp 计算机上的 Oracle DB 获取信息。

但是,当我加载网页时,我收到 ORA-12154: TNS: 无法解析

我的 Tnsname.Ora 上指定的连接标识符,我得到以下信息:

ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 157.xxx.xx.xxx)(PORT = 1521))
    (CONNECT_DATA =

    (SERVICE_NAME = ORCL.company.net)
    )
    )

奇怪的是,当我尝试从 WIN7 中通过 sqlplus 连接时,我可以通过提供以下凭据来做到这一点:

$ sqlplus MyUser/MyPass@ORCL

我得到的 ConnectionString 如下:

有谁知道可能出了什么问题吗?

连接字符串在我的本地开发计算机上运行,​​并带有一个看起来几乎相同的 tnsnames.ora 文件。

任何帮助将不胜感激!

Ive got a winxp remote Oracle Server and a Windows 7 machine with IIS.

I will be hosting a site on the win7 machine, getting information from an Oracle DB on my winxp machine.

However, when i load my webpage, i get ORA-12154:
TNS:could not resolve the connect identifier specified

on my Tnsname.Ora i`ve got the following:

ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 157.xxx.xx.xxx)(PORT = 1521))
    (CONNECT_DATA =

    (SERVICE_NAME = ORCL.company.net)
    )
    )

The weird thing is that when i try to connect through sqlplus from the WIN7, I am able to do so by providing the following credentials:

$ sqlplus MyUser/MyPass@ORCL

The ConnectionString I've got is as follows:

Does anyone have any idea as to what might be wrong?

The connection string works on my local developement machine with a tnsnames.ora file that looks virtually the same.

Any help would be appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

坐在坟头思考人生 2024-12-26 00:04:20

您是否尝试过使用直接连接字符串,例如

Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=157.xxx.xx.xxx)(PORT=1521))
     (CONNECT_DATA=(SERVICE_NAME=ORCL.company.net)));User Id=MyUser;Password=MyPass;

Have you tried using a direct connection string eg

Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=157.xxx.xx.xxx)(PORT=1521))
     (CONNECT_DATA=(SERVICE_NAME=ORCL.company.net)));User Id=MyUser;Password=MyPass;
乖不如嘢 2024-12-26 00:04:20

如果您将系统环境变量 TNS_ADMIN 设置为指向 tnsnames.ora 文件所在的目录,这对您的 Web 服务有帮助吗?在我看来,您的网络服务器正在查看错误的目录,因为它表示无法解析该名称。

If you set the system environment variable TNS_ADMIN to point at the directory where your tnsnames.ora file resides, does it help your web service? It sounds to me like your web server is looking at the wrong directory, since it's saying it can't resolve the name.

冷︶言冷语的世界 2024-12-26 00:04:20
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=157.xxx.xx.xxx)(PORT=1521)) 
     (CONNECT_DATA=(SID=NETBDS)));User Id=MyUser;Password=MyPass; 

试试这个方法怎么样?

Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=157.xxx.xx.xxx)(PORT=1521)) 
     (CONNECT_DATA=(SID=NETBDS)));User Id=MyUser;Password=MyPass; 

how about try this method ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文