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