1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
* 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 = reader["firstname"];
string LastName = 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>
|