2010-04-16 Sebastien Pouliot <sebastien@ximian.com>
[mono/afaerber.git] / web / oracle
bloba83eb776c35025d9349de80518fcf6768d50159c
1 * Oracle Data Provider
3 <ul>
5         <li>ADO.NET Data Provider for <a href="http://www.oracle.com/">Oracle</a> databases</li>
7         <li>Exists in namespace System.Data.OracleClient and assembly System.Data.OracleClient</li>
9         <li>Works on Windows and Linux</li>
11         <li>Works with Oracle 8i and 9i.</li>
13         <li>Uses the Oracle CLI (Call Level Interface) which is a C library (API) for the Oracle Client 
14                 software</li>
16         <li>Internally, the OracleClient provider has OCI abstracted to an object-oriented programming model</li>
18         <li>Created by Daniel Morgan and Tim Coleman</li>
20         <li>Bugs with Mono or the data provider should be reported 
21         in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>.  If you
22         do not have Bugzilla user account, it is free 
23         and easy to 
24         create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
25         
26 </ul>
27         
28 ** Current Status
30 <ul>
31         <li>OracleConnection can connect and disconnect to an Oracle 8i or 9i database on 
32         Windows and Linux via OCI (Oracle Call-level Interface)</li>
33         
34         <li>Can have multiple connections with different transactions where each transaction is
35         separated from the others, so a rollback or commit in one transaction 
36         does not affect the other.</li>
37         
38         <li>Can execute simple DML SQL statements, such as, 
39         INSERT a row into the EMP table via the OracleCommand's ExecuteNonQuery method</li>
40         
41         <li>Can retrieve data via ExecuteReader and OracleDataReader.  Currently, 
42         supports character, numeric, some date data types.  ExecuteScalar
43         also works.</li>
45         <li>Simple input parameters (character and numeric data) can now
46         be used in SQL queries.  Output parameters do not yet work.</li>
47                         
48         <li>OracleException and Error handling exists now.</li>
50         <li>Message handling needs to be added for non-critical messages
51         received from Oracle</li>
52         
53         <li>Handling of various data types need to be added.</li>
54         
55         <li>Data Adapter exists, and a DataSet can be filled using it.</li>
56         
57         <li>Lots of missing functionality and bugs.</li>
58         
59         <li>Works with SQL# command-line and GTK# GUI versions.</li>
60            
61 </ul>
62         
63 ** Action Plan
65 <ul>
66         <li>Be able to retrieve results via a data reader (WORKING)</li>
67         <li>Parameters support (IN PROGRESS)</li>
68         <li>transactions (WORKING)</li>
69         <li>Stored Procedures, Functions, and Packages support</li>
70         <li>Be able to fill a DataTable in a DataSet via a data adapter (IN PROGRESS)</li>
71         <li>Support for Oracle 8i on Linux and Windows (WORKING)</li>
72         <li>Support for Oracle 9i on Linux and Windows (WORKING)</li>
73         <li>Support for Oracle 10g on Linux and Windows [TODO].  Please let us 
74         know on mono-list if Mono OracleClient works with Oracle 10g or not.  If not, what errors do you get</li>
75         <li>Support Large OBjects</li>
76         <li>Support all the data types</li>
77         <li>Implement Connection pooling</li>
78         <li>Security</li>
79         
80 </ul>
82 ** Testing System.Data.OracleClient
84 <ul>
85         <li>Have a working mono and mcs</li>
86         
87         <li>Have access to an Oracle 8i or 9i database or download it from
88         <a href="http://www.oracle.com/">Oracle</a>.  If you are connecting
89         remotely to an Oracle database, you need the Oracle client software.
90         Registration to the <a href="http://technet.oracle.com/">Oracle Technology Network</a> is free.  If installing on Linux, 
91         I suggest you do a lot of searching to see how others installed Oracle on Linux.</li>
92         
93         <li>Make sure System.Data.OracleClient.dll assembly is built.</li>
94         
95         <li>Take a look at TestOracleClient.cs found at mcs/class/System.Data.OracleClient/Test</li>
96         
97         <li>The Data Source is an Oracle TNSNAME</li>
98         
99         <li>Has a connection string format:
100 <pre>
101 "Data Source=tnsname;User ID=userid;Password=password"
102 </pre>  
103         </li>
104         <li>C# Example:
105 <pre>
106  using System;
107  using System.Data;
108  using System.Data.OracleClient;
110  public class Test 
112     public static void Main (string[] args)
113     {
114        string connectionString = 
115           "Data Source=testdb;" +
116           "User ID=scott;" +
117           "Password=tiger;";
118        OracleConnection dbcon = null;
119        dbcon = new OracleConnection (connectionString);
120        dbcon.Open ();
121        OracleCommand dbcmd = dbcon.CreateCommand ();
122        string sql = "SELECT ename, job FROM scott.emp";
123        dbcmd.CommandText = sql;
124        OracleDataReader reader = dbcmd.ExecuteReader ();
125        while (reader.Read ()) {
126           string employeeName = (string) reader["ename"];
127           string job = (string) reader["job"];
128           Console.WriteLine ("Employee Name: {0}  Job: {1}",
129                                     employeeName, job);
130        }
131        // clean up
132        reader.Close ();
133        reader = null;
134        dbcmd.CommandText = sql;
135        dbcmd.ExecuteNonQuery ();
136        dbcmd.Dispose ();
137        dbcmd = null;
138        dbcon.Close ();
139        dbcon = null;
140     }
142 </pre>
143         </li>
144         <li>Building C# Example:
145         <ul>
146                 <li>Save the example to a file, such as, TestExample.cs</li>
147                 <li>Build on Linux:
148 <pre>
149         mcs TestExample.cs -r System.Data.dll \
150             -r System.Data.OracleClient.dll
151 </pre>
152                 </li>
153                 <li>Build on Windows:
154 <pre>
155         mcs TestExample.cs  /r:System.Data.dll \
156             /r:System.Data.OracleClient.dll
157 </pre>
158                 </li>
159         </ul>
160         </li>
161         <li>Running the Example:
162 <pre>
163 mono TestExample.exe
164 </pre>
165         </li>
167 </ul>