问题描述
using System.Data.OracleClient;
string strDSNcon = "Data Source=myOracleDB;uid=uid;pwd=myPass;";
OracleConnection oraConn = new OracleConnection(strDSNcon);
oraConn.Open();
myOracleDB版本是 11.2.0-64bit
当我尝试执行此代码时,它会引发错误-
ORA-12154:TNS:无法解析指定的连接标识符
在System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle,Int32 rc)
我用谷歌搜索了这个错误,并且有很多可能的原因.但在这种情况下什么都没有应用.
这是Oracle 64位的问题吗?
myOracleDB version is 11.2.0 - 64bit
when I try to execute this code, it throws an error-
ORA-12154: TNS:could not resolve the connect identifier specified
at System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle, Int32 rc)
I googled this error and there are a lot of possible cause. but nothing is applied in this scenario.
Is this problem of Oracle 64bit?
推荐答案
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
string oradb = "Data Source=(DESCRIPTION="
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.1)(PORT=1521)))"
+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test.eg.com)));"
+ "User Id=scott;Password=123;";
OracleConnection con = new OracleConnection(oradb);
con.Open();
http://www.connectionstrings.com/oracle [ ^ ]
最好的问候
米特瓦里(M.Mitwalli)
http://www.connectionstrings.com/oracle[^]
Best Regards
M.Mitwalli
这篇关于无法使用OracleClient和OracleDbVersion 11.2.0 64位打开数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!