错误连接到Oracle时,TNS:listener当前不知道连接描述符中请求的服务 [英] Error While connecting to Oracle, TNS:listener does not currently know of service requested in connect descriptor

查看:186
本文介绍了错误连接到Oracle时,TNS:listener当前不知道连接描述符中请求的服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的两周里,我一直在寻找解决方案,并尝试了网络上提到的所有方法,但仍未弄清楚为什么这种情况仍然存在!

I have been searching for a solution for this in the last two weeks and tried all the methods mentioned across the web, yet to figure out why this is still happening !

我能够从SQL Plus连接到Oracle DB,但是当我尝试从C#连接到它时,出现以下错误.

I am able to connect to a Oracle DB from SQL Plus but when i try to connect to it from C# its giving the following error.

{"ORA-12514:TNS:侦听器当前不知道请求的服务 在连接描述符中} System.Exception {Oracle.ManagedDataAccess.Client.OracleException}

{"ORA-12514: TNS:listener does not currently know of service requested in connect descriptor"} System.Exception {Oracle.ManagedDataAccess.Client.OracleException}

SQL plus正在使用LDAP解析连接,但是在C#中,我尝试了以下连接字符串,

SQL plus is resolving the connection using LDAP but in C# I have tried the folloiwng connection strings,

//string strConnectString = "Data Source=XYZ;User ID=user;Password=pwd";

string strConnectString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=ABC1234.Xyz.abc)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=XYZ)));User ID=user;Password=pwd";

但是两个连接字符串都导致错误,我正在使用Oracle.ManagedDataAccess.Client进行连接.

but both connection strings are causing the error, I am using Oracle.ManagedDataAccess.Client for connectivity.

您能请专家指引我正确的方向吗?

Can you experts please direct me in the right direction?

推荐答案

只需更改带有Service_Name的SID的连接字符串,就非常感谢向我指导正确方向的好朋友.

Just changed the connection string with SID insted of Service_Name, Thanks a lot to the good Friends who has guided me in the right direction.

string strConnectString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=ABC1234.Xyz.abc)(PORT=1521)))(CONNECT_DATA=(SID=XYZ)));User ID=user;Password=pwd"

这篇关于错误连接到Oracle时,TNS:listener当前不知道连接描述符中请求的服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆