Home>

I want to connect to Oracle DB from a C # client program.
There are multiple patterns of client environments, and each version of OracleClient installed is different.

Currently, it is built by changing the version of Oracle.DataAccess.dll to be referenced for each client environment.
Please let me know if there is a way to connect to multiple versions of OracleDB in one build.

Development environment
  • Visual Studio 2010
  • Connect to OracleDB with the following code referring to Oracle.DataAccell.dll
using Oracle.DataAccess.Client
public class OracleSample
{
    public void Select ()
    {
        using (var con = new OracleConnection ("connection string"))
        {
            con.Open ();
            var command = con.CreateCommand ();
            command.CommandText = "select * from XXX";
            var reader = command.ExecuteReader ();
            ~ Abbreviated ~
        }
    }
}
Connect to
  • Oracle Database 11g or 12c
Supplement

I have experience in development SE, but I'm almost new to OracleDB.
I would be pleased if you could point out a fundamentally wrong point.

  • Answer # 1

    I can't confirm it because there is no operating environment,
    How about using "ODP.NET Managed Driver"?
    Private summary about ODP.NET Managed Driver (Managed Driver)
    [C #] It seems to be possible to see if you see the connection to Oracle without client installation
    .NetFlamework seems to require 4 or more
    VS2010 seems to be able to go to 4, so it may not be usable depending on which version the project is working on ...

Related articles