| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- * 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.</li>
- <li> Exists in namespace System.Data.OleDb and assembly System.Data</li>
-
- <li>Created by Rodrigo Moya</li>
-
- <li>LibGDA has providers for:</li>
- <ul>
- <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>
- <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
- <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.</li>
-
- <li>Basic
- functionality (execution of commands, data retrieval, transactions, etc) are
- 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.</li>
- </ul>
- ** Action Plan
- <ul>
- <li>Current focus is on filling up the missing pieces (Data adapters
- mainly) and schema support.</li>
-
- <li>We need help building libgda on Windows though. libgda
- builds find on linux though.</li>
- <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>
|