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