Click here to Skip to main content
12,698,531 members (23,677 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170118.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2017
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