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. Mono.Data.MySql is no longer included in
24 <li>Bugs with Mono or the data provider should be reported
25 in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
26 do not have Bugzilla user account, it is free
28 create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
32 <p><a href="http://www.mysql.com/articles/dotnet/">Exploring MySQL
33 in the Microsoft .NET Environment</a> is a nice article to read.</li>
37 Current Status of the MySQL providers:
41 <li>ByteFX.Data.MySqlClient
43 <li>Build and Runs on Microsoft .NET and Mono</li>
44 <li>Works with SQL# (command-line and GTK# GUI versions)</li>
\r
45 <li>MySQLCommandBuilder now implemented</li>
\r
46 <li>Transaction support now implemented (not all table types support this)</li>
\r
47 <li>GetSchemaTable fixed to not use xsd (for Mono)</li>
\r
48 <li>Driver is now Mono-compatible</li>
\r
49 <li>TIME data type now supported</li>
\r
50 <li>More work to improve Timestamp data type handling</li>
\r
51 <li>Changed signatures of all classes to match corresponding SqlClient classes</li>
\r
52 <li>Protocol compression using <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/default.asp">SharpZipLib</a></li>
\r
53 <li>Named pipes on Windows now working properly</li>
\r
54 <li>Work done to improve Timestamp data type handling</li>
\r
55 <li>Implemented IEnumerable on DataReader so DataGrid would work</li>
\r
56 <li>Speed increased dramatically by removing bugging network sync code</li>
\r
57 <li>Driver no longer buffers rows of data (more ADO.Net compliant)</li>
\r
58 <li>Conversion bugs related to TIMESTAMP and DATETIME fields fixed</li>
\r
63 <li>Mono.Data.MySql (DEPRECATED)
70 The current plan for the MySQL data providers:
73 <li>ByteFX.Data.MySqlClient
75 <li>Testing and fixes</li>
76 <li>Implement missing features</li>
77 <li>Only fixes for bugs to build and run MySQLClient on Mono
78 will be accepted in mono-cvs. Most bugs and any new features will
79 go into sourceforge cvs. Anytime there is a release of MySQLClient,
80 the source code will be copied from sourceforge cvs to mono-cvs</li>
81 <li>Releases of MySQLClient are determined by Reggie Burnett and releases
82 of Mono are determined by Miguel de Icaza</li>
83 <li>Implement any missing features or fix any bugs in Mono to get new
84 features all of MySQLClient to work on Mono</li>
87 <li>Mono.Data.MySql (DEPRECATED)
91 ** Testing for MySQLNet provider (ByteFX.Data.MySQLClient)
94 <li>Have access to a MySQL database or download it from
96 <li><a href="http://www.mysql.com/downloads/index.html">MySQL AB</a></li>
100 <li>MySQLNet can be gotten from <a href="http://sourceforge.net/projects/mysqlnet/">here</a> and the
101 binary assembly ByteFX.Data.dll needs to be installed
102 in the same place as the mono class libraries.</li>
104 <li>MySQLNet requires <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/default.asp">SharpZipLib</a> which is
105 a Zip Library written in 100% C#. This is used for compression/decompression of data
106 sent/received over the network. The SharpZipLib binary assembly SharpZipLib.dll should
107 be installed in the same place as the mono class libraries.</li>
109 <li>Has a ConnectionString format:
112 "Database=database;" +
113 "User ID=username;" +
121 using ByteFX.Data.MySqlClient;
125 public static void Main(string[] args)
127 string connectionString =
128 "Server=localhost;" +
130 "User ID=myuserid;" +
131 "Password=mypassword;";
133 dbcon = new MySqlConnection(connectionString);
135 IDbCommand dbcmd = dbcon.CreateCommand();
136 // requires a table to be created named employee
137 // with columns firstname and lastname
139 // CREATE TABLE employee (
140 // firstname varchar(32),
141 // lastname varchar(32));
143 "SELECT firstname, lastname " +
145 dbcmd.CommandText = sql;
146 IDataReader reader = dbcmd.ExecuteReader();
147 while(reader.Read()) {
148 string FirstName = (string) reader["firstname"];
149 string LastName = (string) reader["lastname"];
150 Console.WriteLine("Name: " +
151 FirstName + " " + LastName);
164 <li>Building C# Example:
166 <li>Save the example to a file, such as, TestExample.cs</li>
168 mcs TestExample.cs -r System.Data.dll \
174 <li>Running the Example: