andreas domevscek

andreas domevscek

  • NA
  • 21
  • 8.6k

Oracle Connection over ODBC

Sep 23 2014 5:51 PM

Hello,

 

I want to connect with oracle database.
my Connection String in web.config:

<connectionStrings>

<add name="ConStrOrcl" connectionString="Driver=ODBCDriver;Data Source=localhost:1521/orcl;User Id=uid;Password=pwd" providerName="System.Data.Odbc"/>

</connectionStrings>

 
in webapp i have

string CS = ConfigurationManager.ConnectionStrings["ConStrOrcl"].ConnectionString;

OdbcConnection con = new OdbcConnection(CS);

OdbcCommand cmd = new OdbcCommand ("select Id, CityName, Country from nha.tblCity", con);

con.Open();

but when con.open gives me an error
 
ERROR [IM002] [Microsoft][ODBC-stuurprogrammabeheer] De naam van de gegevensbron is niet gevonden en er is geen standaardstuurprogramma opgegeven  
 
Can someone give me the clue? 
 

Answers (2)