* Oracle Data Provider
"Data Source=tnsname;User ID=userid;Password=password"
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;" + "Password=tiger;"; IDbConnection dbcon; dbcon = new OracleConnection (connectionString); dbcon.Open (); IDbCommand dbcmd = dbcon.CreateCommand (); string sql = "SELECT ename, job FROM scott.emp"; dbcmd.CommandText = sql; IDataReader reader = dbcmd.ExecuteReader (); while (reader.Read ()) { string employeeName = reader["ename"]; string job = 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; } }
mcs TestExample.cs -r System.Data.dll \ -r System.Data.OracleClient.dll
mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \ TestExample.cs \ -lib:C:/cygwin/home/MyHome/mono/install/lib \ -r System.Data.dll -r System.Data.OracleClient.dll
mono TestExample.exe