Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.0 C#3.0 Oracle
using System.Data.OracleClient;
	
string strDSNcon = "Data Source=myOracleDB;uid=uid;pwd=myPass;";
OracleConnection oraConn = new OracleConnection(strDSNcon);
oraConn.Open();
 
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?
Posted 2-Sep-12 23:12pm
ashriv947

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi ,
 
Make sure you add reference Oracle.DataAccess
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[^]
Best Regards
M.Mitwalli
  Permalink  
v2
Comments
Manas Bhardwaj at 3-Sep-12 6:23am
   
Yes 5!
Mohamed Mitwalli at 3-Sep-12 6:27am
   
Thanks Manas

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 340
1 OriginalGriff 210
2 DamithSL 170
3 Kornfeld Eliyahu Peter 130
4 Peter Leow 95
0 OriginalGriff 7,315
1 DamithSL 5,199
2 Sergey Alexandrovich Kryukov 4,917
3 Maciej Los 4,866
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100