[Mono-dev] MySql and Mono using System.Data.Common

Gonzalo Paniagua gonzalo.mono at gmail.com
Sun Apr 20 16:30:58 EDT 2008


On Sun, 2008-04-20 at 04:39 -0400, Wael Zeenni wrote:
> Hey all,
> 
> I'm having some issues trying to get MySql to work with
> System.Data.Common. On my Windows 2003 server I'm running a test
> application and switching between MS SQL and MySql at runtime and
> everything works fine.
> 
> However, when I run my application in Mono, I keep getting the
> following error:
> 
> 
> -----------------
> Failed to find or load the registered .Net Framework Data Provider
> 'MySql.Data.MySqlClient'. () ()
> Description: HTTP 500. Error processing request.
> 
> Stack Trace: 
> 
> System.Configuration.ConfigurationErrorsException: Failed to find or load the registered .Net Framework Data Provider 'MySql.Data.MySqlClient'. () ()
>   at System.Data.Common.DbProviderFactories.GetFactory (System.String providerInvariantName) [0x00000] 
>   at _Default.btnLogin_Click (System.Object sender, System.Web.UI.ImageClickEventArgs e) [0x00000] 
>   at System.Web.UI.WebControls.ImageButton.OnClick (System.Web.UI.ImageClickEventArgs e) [0x00000] 
>   at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent (System.String eventArgument) [0x00000] 
>   at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent (System.String eventArgument) [0x00000] 
>   at System.Web.UI.Page.RaisePostBackEvent (IPostBackEventHandler sourceControl, System.String eventArgument) [0x00000] 
>   at System.Web.UI.Page.RaisePostBackEvents () [0x00000] 
>   at System.Web.UI.Page.ProcessRaiseEvents () [0x00000] 
>   at System.Web.UI.Page.InternalProcessRequest () [0x00000] 
>   at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] 
> 
> ______________________________________________________________________
> Version information: Mono Version: 2.0.50727.42; ASP.NET Version:
> 2.0.50727.42 
> -------------------------
> 
> 
> The MySql.Data is registered correctly in my GAC. Like I said, it
> works in Windows, but not in OpenSUSE 10.3. Can anyone please help me
> as I have to develop a cross OS, cross DB web application and this is
> kind of hindering my efforts.
> 
> Also, according to this page on the mono-project.com website:
> http://www.mono-project.com/BaseClass_Provider_Factory
> 
> It says that as of now, only the following providers can be accessed:
>       * System.Data.SqlClient 
>       * System.Data.Odbc 
> But I'm not sure when that page was last updated.
> 
> Can anyone please help me?

You need something like this in your app.exe.config or in
machine.config:
---
<system.data>
        <DbProviderFactories>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" 
         description=".Net Framework Data Provider for MySQL"  
         type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, 
               Version=5.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
	</DbProviderFactories>
</system.data>
---

-Gonzalo




More information about the Mono-devel-list mailing list