0

I am new to Databases and .net!

I have SQL developer 3.0 installed through which I can connect to the Oracle 11g Database server.

The requirement is to write a C# program to connect to the oracle database and run query; in my visual studio 2013 project I have added a reference to Oracle.DataAccess.Client and written the code, however while debugging an error occurs that says "Ora-12541:TNS:No-Listener".

My question for now is, Do I need to install an Oracle client (64-bit ODAC 11.2 Release 6 (11.2.0.4.0) Xcopy for Windows x64 ?), my assumption was SQL developer will take care of this!

Please help!

Nj_Acc
  • 38
  • 5
  • If connectivity is the main concern, and not any design time features, just use the NuGet packages. No client or drivers install necessary at all. – Maarten Feb 19 '15 at 13:12

2 Answers2

2

SQL Developer has it's own Oracle drivers (JDBC as far as I know), thus you must install Oracle Client in order to connect to an Oracle DB in Visual Studio.

Note, "ODAC" contains only the ODP.NET Data Provider (i.e. mainly the Oracle.DataAccess.dll file). In order to use it, you must install the actual Oracle Client - at least the Instant Client (which is also included in the ODAC Download file).

Consider to use the ODP.NET Managed Driver, then you need only one single DLL, nothing else. It can be downloaded from Oracle page 64-bit Oracle Data Access Components (ODAC) Downloads and works for both 32bit and 64bit applications.

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • All oracle ODAC packages that have the .net provider include some version of the requisite client. – b_levitt Feb 19 '15 at 12:48
  • I will second the suggestion that you use the Managed Driver. Oracle is a great big pain to use via .NET. Especially, but not only, if you try using it with the Entity Framework. If you click my name and have a look at my previous questions, you'll see a I asked a few questions that show common problems with ODAC and ODP.NET. – Captain Kenpachi Feb 19 '15 at 13:12
0

Unless you copied Oracle.DataAccess.dll from another machine, all oracle packages that include it, also include some version of the client. ODAC includes the full version while the xcopy installs have the instant client. I'll also point to the managed provider though for simplicity as it does not have any unmanaged dependencies,

However, if you got all the way to an "ora-xxxxx" error, it sounds like your Oracle client is correctly installed. The only issue you have now is your connection string. If you normally use a TNS name in Sql Developer, than you either need to copy your existing tnsnames.ora to network/admin in your new oracle home dir, or you need to set a TNS_ADMIN system environment variable to point to your existing one. There are other options too, but your error in this case is tns specific.

b_levitt
  • 7,059
  • 2
  • 41
  • 56