3 <p>There are two ADO.NET providers in Mono
4 for a <a href="http://www.mysql.com/">MySQL</a> database:
7 <li><a href="http://sourceforge.net/projects/mysqlnet/">ByteFX.Data.MySQLClient</a>
9 <li>Written in 100% C#</li>
10 <li>Does not require a client library</li>
11 <li>Works on Mono and Microsoft .NET</li>
12 <li>Requires at least Mono 0.18 and MySQLNet 0.65 for it to work on Mono</li>
13 <li>Works in the SQL# command-line and GTK# GUI version</li>
17 <li>Mono.Data.MySql (deprecated)
19 <li>Deprecated in favor of ByteFX.Data.MySQLClient
21 <li>Written in C# and uses
22 the MySQL C Client Library</li>
24 <li>Exists in namespace Mono.Data.MySql and assembly Mono.Data.MySql</li>
26 <li>Works on Windows and Linux via the MySQL client shared library
27 (libmySQL.dll on Windows and libmysqlclient.so on Linux).</li>
29 <li>Started by Daniel Morgan using
30 <a href="http://www.cybercom.net/~zbrad/DotNet/MySql/">C# Bindings to MySQL</a> from <a href="mailto:zbrad@cybercom.net">Brad Merill</a></li>
34 <li>Bugs with Mono or the data provider should be reported
35 in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
36 do not have Bugzilla user account, it is free
38 create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
42 <p><a href="http://www.mysql.com/articles/dotnet/">Exploring MySQL
43 in the Microsoft .NET Environment</a> is an article
44 by Mr. Venu who is a MySQL AB developer.</li>
46 <p>Testing for Mono's Mono.Data.MySql and ByteFX's ByteFX.Data.MySqlClient is below.
50 Current Status of the MySQL providers:
54 <li>ByteFX.Data.MySqlClient
56 <li>Build and Runs on Microsoft .NET and Mono</li>
57 <li>Works with SQL# (command-line and GTK# GUI versions)</li>
\r
58 <li>MySQLCommandBuilder now implemented</li>
\r
59 <li>Transaction support now implemented (not all table types support this)</li>
\r
60 <li>GetSchemaTable fixed to not use xsd (for Mono)</li>
\r
61 <li>Driver is now Mono-compatible</li>
\r
62 <li>TIME data type now supported</li>
\r
63 <li>More work to improve Timestamp data type handling</li>
\r
64 <li>Changed signatures of all classes to match corresponding SqlClient classes</li>
\r
65 <li>Protocol compression using <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/default.asp">SharpZipLib</a></li>
\r
66 <li>Named pipes on Windows now working properly</li>
\r
67 <li>Work done to improve Timestamp data type handling</li>
\r
68 <li>Implemented IEnumerable on DataReader so DataGrid would work</li>
\r
69 <li>Speed increased dramatically by removing bugging network sync code</li>
\r
70 <li>Driver no longer buffers rows of data (more ADO.Net compliant)</li>
\r
71 <li>Conversion bugs related to TIMESTAMP and DATETIME fields fixed</li>
\r
76 <li>Mono.Data.MySql (deprecated)
78 <li>Currently, only works with version 3.23.x of MySQL</li>
82 <li>can execute non-queries via ExecuteNonQuery()</li>
84 <li>can execute aggregates via ExecuteScalar() and retrieve the
85 single row/single column result</li>
87 <li>can execute queries and retrieve results using a data reader.</li>
89 <li>a schema DataTable has been partially
90 implemented which is returned from GetSchemaTable() in MySqlDataReader.</li>
92 <li>a DataTable in a DataSet can be filled via a MySqlDataAdapter</li>
94 <li>The shared client libraries
95 between windows version and linux are different: windows has libmySQL.dll
96 while linux has libmysqlclient.so. This is handled by the
97 file etc/mono/config which is mapped by the mono runtime in knowing
98 which native shared library to load. In cvs, this file is mono/config.in and
99 can be modified with a text editor.</li>
101 <li>Works in the SQL# command-line and GTK# GUI version</li>
109 The current plan for the MySQL data providers:
112 <li>ByteFX.Data.MySqlClient
114 <li>Testing and fixes</li>
115 <li>Implement missing features</li>
116 <li>Only fixes for bugs to build and run MySQLClient on Mono
117 will be accepted in mono-cvs. Most bugs and any new features will
118 go into sourceforge cvs. Anytime there is a release of MySQLClient,
119 the source code will be copied from sourceforge cvs to mono-cvs</li>
120 <li>Releases of MySQLClient are determined by Reggie Burnett and releases
121 of Mono are determined by Miguel de Icaza</li>
122 <li>Implement any missing features or fix any bugs in Mono to get new
123 features all of MySQLClient to work on Mono</li>
126 <li>Mono.Data.MySql (deprecated)
128 <li>Testing and bug fixes</li>
129 <li>Mono.Data.MySql is deprecated and therefore maybe removed
130 at a later date. It will stay in Mono for now because other
131 programs maybe using it now.</li>
136 ** Testing for MySQLNet provider (ByteFX.Data.MySQLClient)
139 <li>Have access to a MySQL database or download it from
141 <li><a href="http://www.mysql.com/downloads/index.html">MySQL AB</a></li>
145 <li>MySQLNet can be gotten from <a href="http://sourceforge.net/projects/mysqlnet/">here</a> and the
146 binary assembly ByteFX.Data.dll needs to be installed
147 in the same place as the mono class libraries.</li>
149 <li>MySQLNet requires <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/default.asp">SharpZipLib</a> which is
150 a Zip Library written in 100% C#. This is used for compression/decompression of data
151 sent/received over the network. The SharpZipLib binary assembly SharpZipLib.dll should
152 be installed in the same place as the mono class libraries.</li>
154 <li>Has a ConnectionString format:
157 "Database=database;" +
158 "User ID=username;" +
166 using ByteFX.Data.MySqlClient;
170 public static void Main(string[] args)
172 string connectionString =
173 "Server=localhost;" +
175 "User ID=myuserid;" +
176 "Password=mypassword;";
178 dbcon = new MySqlConnection(connectionString);
180 IDbCommand dbcmd = dbcon.CreateCommand();
181 // requires a table to be created named employee
182 // with columns firstname and lastname
184 // CREATE TABLE employee (
185 // firstname varchar(32),
186 // lastname varchar(32));
188 "SELECT firstname, lastname " +
190 dbcmd.CommandText = sql;
191 IDataReader reader = dbcmd.ExecuteReader();
192 while(reader.Read()) {
193 string FirstName = (string) reader["firstname"];
194 string LastName = (string) reader["lastname"];
195 Console.WriteLine("Name: " +
196 FirstName + " " + LastName);
209 <li>Building C# Example:
211 <li>Save the example to a file, such as, TestExample.cs</li>
214 mcs TestExample.cs -r System.Data.dll \
218 <li>Build on Windows via Cygwin:
220 mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
222 -lib:C:/cygwin/home/MyHome/mono/install/lib \
223 -r System.Data.dll -r ByteFX.Data.dll
228 <li>Running the Example:
236 ** Testing for Mono's MySQL provider (Mono.Data.MySql)
239 <li>Have access to a MySQL database or download it from
241 <li><a href="http://www.mysql.com/downloads/index.html">MySQL AB</a></li>
245 <li>Take a look at MySqlTest.cs in mcs/class/Mono.Data.MySql/Test</li>
246 <li>On Linux, you may need to make a symbolic link from libmySQL.dll to libmysqlclient.dll</li>
248 <li>Has a ConnectionString format:
250 "Server=hostname;Database=database;User ID=username;Password=password"
252 "Host=hostname;Dbname=database;User=username;Passwd=password"
259 using Mono.Data.MySql;
263 public static void Main(string[] args)
265 string connectionString =
266 "Server=localhost;" +
268 "User ID=myuserid;" +
269 "Password=mypassword;";
271 dbcon = new MySqlConnection(connectionString);
273 IDbCommand dbcmd = dbcon.CreateCommand();
274 // requires a table to be created named employee
275 // with columns firstname and lastname
277 // CREATE TABLE employee (
278 // firstname varchar(32),
279 // lastname varchar(32));
281 "SELECT firstname, lastname " +
283 dbcmd.CommandText = sql;
284 IDataReader reader = dbcmd.ExecuteReader();
285 while(reader.Read()) {
286 string FirstName = (string) reader["firstname"];
287 string LastName = (string) reader["lastname"];
288 Console.WriteLine("Name: " +
289 FirstName + " " + LastName);
302 <li>Building C# Example:
304 <li>Save the example to a file, such as, TestExample.cs</li>
309 -r Mono.Data.MySql.dll
312 <li>Build on Windows via Cygwin:
314 mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
316 -lib:C:/cygwin/home/MyHome/mono/install/lib \
318 -r Mono.Data.MySql.dll
323 <li>Running the Example: