Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
executable file 169 lines (132 sloc) 5.06 KB
* Oracle Data Provider
<li>ADO.NET Data Provider for <a href="">Oracle</a> databases</li>
<li>Exists in namespace System.Data.OracleClient and assembly System.Data.OracleClient</li>
<li>Works on Windows and Linux</li>
<li>Works with Oracle 8i and 9i.</li>
<li>Uses the Oracle CLI (Call Level Interface) which is a C library (API) for the Oracle Client
<li>Internally, the OracleClient provider has OCI abstracted to an object-oriented programming model</li>
<li>Created by Daniel Morgan and Tim Coleman</li>
<li>Bugs with Mono or the data provider should be reported
in Mono's Bugzilla <a href="">here</a>. If you
do not have Bugzilla user account, it is free
and easy to
create one <a href="">here</a>.</li>
** Current Status
<li>OracleConnection can connect and disconnect to an Oracle 8i or 9i database on
Windows and Linux via OCI (Oracle Call-level Interface)</li>
<li>Can have multiple connections with different transactions where each transaction is
separated from the others, so a rollback or commit in one transaction
does not affect the other.</li>
<li>Can execute simple DML SQL statements, such as,
INSERT a row into the EMP table via the OracleCommand's ExecuteNonQuery method</li>
<li>Can retrieve data via ExecuteReader and OracleDataReader. Currently,
supports character, numeric, some date data types. ExecuteScalar
also works.</li>
<li>Simple input parameters (character and numeric data) can now
be used in SQL queries. Output parameters do not yet work.</li>
<li>OracleException and Error handling exists now.</li>
<li>Message handling needs to be added for non-critical messages
received from Oracle</li>
<li>Handling of various data types need to be added.</li>
<li>Data Adapter exists, and a DataSet can be filled using it.</li>
<li>Lots of missing functionality and bugs.</li>
<li>Works with SQL# command-line and GTK# GUI versions.</li>
** Action Plan
<li>Be able to retrieve results via a data reader (WORKING)</li>
<li>Parameters support (IN PROGRESS)</li>
<li>transactions (WORKING)</li>
<li>Stored Procedures, Functions, and Packages support</li>
<li>Be able to fill a DataTable in a DataSet via a data adapter (IN PROGRESS)</li>
<li>Support for Oracle 8i on Linux and Windows (WORKING)</li>
<li>Support for Oracle 9i on Linux and Windows (WORKING)</li>
<li>Support for Oracle 10g on Linux and Windows [TODO]. Please let us
know on mono-list if Mono OracleClient works with Oracle 10g or not. If not, what errors do you get</li>
<li>Support Large OBjects</li>
<li>Support all the data types</li>
<li>Implement Connection pooling</li>
** Testing System.Data.OracleClient
<li>Have a working mono and mcs</li>
<li>Have access to an Oracle 8i or 9i database or download it from
<a href="">Oracle</a>. If you are connecting
remotely to an Oracle database, you need the Oracle client software.
Registration to the <a href="">Oracle Technology Network</a> is free. If installing on Linux,
I suggest you do a lot of searching to see how others installed Oracle on Linux.</li>
<li>Make sure System.Data.OracleClient.dll assembly is built.</li>
<li>Take a look at TestOracleClient.cs found at mcs/class/System.Data.OracleClient/Test</li>
<li>The Data Source is an Oracle TNSNAME</li>
<li>Has a connection string format:
"Data Source=tnsname;User ID=userid;Password=password"
<li>C# Example:
using System;
using System.Data;
using System.Data.OracleClient;
public class Test
public static void Main (string[] args)
string connectionString =
"Data Source=testdb;" +
"User ID=scott;" +
OracleConnection dbcon = null;
dbcon = new OracleConnection (connectionString);
dbcon.Open ();
OracleCommand dbcmd = dbcon.CreateCommand ();
string sql = "SELECT ename, job FROM scott.emp";
dbcmd.CommandText = sql;
OracleDataReader reader = dbcmd.ExecuteReader ();
while (reader.Read ()) {
string employeeName = (string) reader["ename"];
string job = (string) reader["job"];
Console.WriteLine ("Employee Name: {0} Job: {1}",
employeeName, job);
// clean up
reader.Close ();
reader = null;
dbcmd.CommandText = sql;
dbcmd.ExecuteNonQuery ();
dbcmd.Dispose ();
dbcmd = null;
dbcon.Close ();
dbcon = null;
<li>Building C# Example:
<li>Save the example to a file, such as, TestExample.cs</li>
<li>Build on Linux:
mcs TestExample.cs -r System.Data.dll \
-r System.Data.OracleClient.dll
<li>Build on Windows:
mcs TestExample.cs /r:System.Data.dll \
<li>Running the Example:
mono TestExample.exe
Jump to Line
Something went wrong with that request. Please try again.