Click here to Skip to main content
11,921,354 members (57,885 online)
Rate this:
Please Sign up or sign in to vote.
See more: .NET3.0 C#3.0 C# .NET Oracle
using System.Data.OracleClient;
string strDSNcon = "Data Source=myOracleDB;uid=uid;pwd=myPass;";
OracleConnection oraConn = new OracleConnection(strDSNcon);

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

1 solution

Rate this: bad
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="
                + "(CONNECT_DATA=(SERVER=DEDICATED)(;"
                + "User Id=scott;Password=123;";

                OracleConnection con = new OracleConnection(oradb);
Best Regards
Manas Bhardwaj 3-Sep-12 6:23am
Yes 5!
Mohamed Mitwalli 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 OriginalGriff 543
1 Dave Kreskowiak 245
2 phil.o 160
3 KrunalRohit 134
4 Sergey Alexandrovich Kryukov 132
0 OriginalGriff 6,951
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,171
3 George Jonsson 2,840
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2015
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