1

Obviously I'd like to not have to install an Oracle client (other than simply a DLL), because that would prohibit my ClickOnce goal. I tried System.Data.OracleClient, but it threw an exception, "System.Data.OracleClient requires Oracle client software version 8.1.7 or greater."

Update:
It seems that System.Data.OracleClient is not the way to go. So I downloaded the xcopy-able version of the Oracle ODP.NET provider. I then ran "install.bat odp.net20 c:\oracle odac" to install only ODP.NET. Then I added a reference in my project to C:\oracle\odp.net\bin\2.x\Oracle.DataAccess.dll. This allowed me to hit the Oracle DB. But when I take all my files to a clean machine (including the oracle DLL), I get an exception: "The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception." So it seems that it is still depending on some other files. But I don't know what files. And how does it know where the files are? A registry entry? Not looking good for ClickOnce.

Update:
It works as long as I include the files mentioned by mcauthorn: oci.dll, oracle.dataaccess.dll, oraociei11.dll, & oraops11w.dll. Unfortunately, oraociei11.dll is very large -- 114MB.

3 Answers 3

2

I would say to go get the ODP.Net Dlls here. You will have to grab the XCopy version, and then add the necessary DLLs to your project and you then should be good to go. The System.Data.OracleClient has been discontinued and is not recommended by Microsoft.

2
  • The Dlls you need to add to your project from ODP.Net are: oci.dll, oracle.dataaccess.dll, oraociei11.dll, & oraops11w.dll. Make sure those are set to always copy in your project. That should be all you need for basic Oracle access.
    – mcauthorn
    Commented Apr 19, 2010 at 16:11
  • It might work on Linux if you have the Linux version of OracleClient installed. Though the chances of that happening might be higher if you have 32 bit Linux. Otherwise, use System.Data.OracleClient, it's deprecated, but it still works great (also requires System.Data.OracleClient). Commented Nov 17, 2013 at 8:32
0

You can use third-party ADO.NET provider. Try this one. It does not require Oracle Client and runs on Mono.

1
  • We pay enough for Oracle. Paying for something else to connect to Oracle won't make sense to the people who write the checks.
    – Fantius
    Commented Apr 15, 2010 at 17:58
0

Update, since the original answers are 4 years old.

Just use Oracle's Managed driver. You need only that, nothing else. You can then connect directly with a simple connection string to the database.

<system.data>
  <DbProviderFactories>
    <remove invariant="Oracle.ManagedDataAccess.Client" />
    <!-- If any should be in the machine.config -->
    <add name="Oracle Data Provider for .NET" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral" />
  </DbProviderFactories>
</system.data>
<connectionStrings>
  <clear />
  <add name="OracleContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="DATA SOURCE=<IP_ADDRESS>:1521/XE;PASSWORD=<PASSWORD>;USER ID=<USER_ID>;Connection Timeout=600;Validate Connection=true" />
</connectionStrings>

I used ServiceStack's OrmLite as ORM but it should work perfectly fine also directly if you don't want to use an ORM, or with any other. All you need to make sure is that your ORM library is using the managed driver as well and not the old one. I've written a blog post regarding a hack, where I had to change ServiceStack.OrmLite.Oracle to use the new managed driver. This solved all my problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.