2009-07-02 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / web / oledb
index d1b16252d145e865be1f4ebfcb66e94a31ed1c16..1dabe6244edd667b6a2b03d01c5cc1fbb4c9cdc5 100755 (executable)
--- a/web/oledb
+++ b/web/oledb
 * OLE DB Provider
+
 <ul>
        <li> Provides a OleDb-like provider for Mono
-       using <a href="http://www.gnome-db.org/">GDA</a> as the data access layer.
+       using <a href="http://www.gnome-db.org/">GDA</a> as the data access layer.</li>
 
-       <li> Exists in namespace System.Data.OleDb and assembly System.Data
+       <li> Exists in namespace System.Data.OleDb and assembly System.Data</li>
        
-       <li>Created by Rodrigo Moya
+       <li>Created by Rodrigo Moya</li>
        
-       <li>LibGDA has providers for:
+       <li>LibGDA has providers for:</li>
        <ul> 
-                 <li><a href="http://www.mysql.com/">MySQL</a> 
-                 <li><a href="http://www.postgresql.org/">PostgreSQL</a>
-                 <li>XML
-                 <li>ODBC (via <a href="http://www.unixodbc.org/">unixODBC</a>)
-                 <li><a href="http://www.oracle.com/">Oracle</a>
-                 <li><a href="http://www.borland.com/products/downloads/download_interbase.html">Interbase</a>
+                 <li><a href="http://www.mysql.com/">MySQL</a></li>
+                 <li><a href="http://www.postgresql.org/">PostgreSQL</a></li>
+                 <li>XML</li>
+                 <li>ODBC (via <a href="http://www.unixodbc.org/">unixODBC</a>)</li>
+                 <li><a href="http://www.oracle.com/">Oracle</a></li>
+                 <li><a href="http://www.borland.com/products/downloads/download_interbase.html">Interbase</a></li>
                  <li><a href="http://www.sybase.com/downloads">Sybase</a> and
                  <a href="http://www.microsoft.com/sql/default.asp">Microsoft SQL Server</a> (
-                 via <a href="http://www.freetds.org/">FreeTDS</a>)
-                 <li><a href="http://www-3.ibm.com/software/data/db2/">IBM DB2 Universal Database</a>
-                 <li><a href="http://www.hwaci.com/sw/sqlite/download.html">SQL Lite</a>
-                 <li><a href="http://www.microsoft.com/office/access/default.asp">MS Access</a> 
-                 (via <a href="http://mdbtools.sourceforge.net/">MDB Tools</a>)
+                 via <a href="http://www.freetds.org/">FreeTDS</a>)</li>
+                 <li><a href="http://www-3.ibm.com/software/data/db2/">IBM DB2 Universal Database</a></li>
+                 <li><a href="http://www.hwaci.com/sw/sqlite/download.html">SQL Lite</a></li>
+                 <li><a href="http://www.microsoft.com/office/access/default.asp">MS Access</a></li>
+                 (via <a href="http://mdbtools.sourceforge.net/">MDB Tools</a>)</li>
        </ul>
+       </li>
+       
+       <li>Does not support trusted connections</li>
+       
+       <li>Bugs with Mono or the data provider should be reported 
+       in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>.  If you
+       do not have Bugzilla user account, it is free 
+       and easy to 
+       create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
+
+       
 </ul>
        
-* Current Status
+** Current Status
        <ul>
                <li>The OleDb provider is working with libgda (an OLE-DB/ADO data access for Unix).  
                The C-Sharp bindings to libgda currently work - meaning they can compile, run, 
                and you can connect to a
-               PostgreSQL database via libgda via the C-Sharp bindings to libgda.  
+               PostgreSQL database via libgda via the C-Sharp bindings to libgda.</li>
        
                <li>Basic
                functionality (execution of commands, data retrieval, transactions, etc) are
-               now working. 
+               now working.</li>
        
                <li>An inital implementation of GetSchemaTable() for
                the OleDbDataReader has been checked into cvs.  GetSchemaTable() isn't correct for OleDb,
-               but the foundation is there.
+               but the foundation is there.</li>
        </ul>
 
-* Action Plan
+** Action Plan
        <ul>
                <li>Current focus is on filling up the missing pieces (Data adapters
-               mainly) and schema support.  
+               mainly) and schema support.</li>
        
                <li>We need help building libgda on Windows though.  libgda
-               builds find on linux though.  
+               builds find on linux though.</li>
 
-               <li>Need to make the OleDb provider compatible with the OleDb provider in Microsoft .NET
+               <li>Need to make the OleDb provider compatible with the OleDb provider in Microsoft .NET</li>
        </ul>
+       
+** Testing OleDb with libgda's PostgreSQL provider
+
+<ul>
+       <li>Requires a working mono and mcs</li>
+       <li>Requires Linux because the OleDb provider uses libgda and libgda only
+       works on Linux.</li>
+       <li>Connection String format: "Provider=providerName;...".  providerName is the
+       name of the Provider you use, such as, PostgreSQL, MySQL, etc.  The elipsis ...
+       means that the connection parameters are dependent upon the provider being used and
+       are passed to libgda for connecting.  Such paramters, can be: Database, User ID, Password,
+       Server, etc...</li>
+       <li>See the test TestOleDb.cs found at mcs/class/System.Data/System.Data.OleDb</li>
+       <li>C# Example for Mono's System.Data.OleDb:
+<pre>
+ using System;
+ using System.Data;
+ using System.Data.OleDb;
+ public class Test 
+ {
+    public static void Main(string[] args)
+    {
+               // there is a libgda PostgreSQL provider
+       string connectionString = 
+          "Provider=PostgreSQL;" +
+          "Addr=127.0.0.1;" +
+          "Database=test;" +
+          "User ID=postgres;" +
+          "Password=fun2db";
+       IDbConnection dbcon;
+       dbcon = new OleDbConnection(connectionString);
+       dbcon.Open();
+       IDbCommand dbcmd = dbcon.CreateCommand();
+       // requires a table to be created named employee
+       // with columns firstname and lastname
+       // such as,
+       //        CREATE TABLE employee (
+       //           firstname varchar(32),
+       //           lastname varchar(32));
+       string sql = 
+            "SELECT firstname, lastname " + 
+            "FROM employee";
+       dbcmd.CommandText = sql;
+       IDataReader reader = dbcmd.ExecuteReader();
+       while(reader.Read()) {
+            string FirstName = (string) reader["firstname"];
+            string LastName = (string) reader["lastname"];
+            Console.WriteLine("Name: " + 
+                 FirstName + " " + LastName);
+       }
+       // clean up
+       reader.Close();
+       reader = null;
+       dbcmd.Dispose();
+       dbcmd = null;
+       dbcon.Close();
+       dbcon = null;
+    }
+ }
+</pre>
+       </li>
+       <li>Building C# Example:
+       <ul>
+               <li>Save the example to a file, such as, TestExample.cs</li>
+               <li>Build on Linux:
+<pre>
+       mcs TestExample.cs -r System.Data.dll
+</pre>
+               </li>
+               <li>Build on Windows via Cygwin:
+<pre>
+       mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
+            TestExample.cs \
+            -lib:C:/cygwin/home/MyHome/mono/install/lib \
+            -r System.Data.dll
+</pre>
+               </li>
+       </ul>
+       </li>
+       <li>Running the Example:
+<pre>
+mono TestExample.exe
+</pre>
+</li>
+
+</ul>
+