views:

32

answers:

2

I've been having quite a bit of trouble getting an MVC2 web application to find the MySQL connector. I am running CentOS 5.

I've installed the DLL into the GAC using the 2.0 version of the tool

$ mono /usr/local/lib/mono/2.0/gacutil.exe -i v2/mysql.data.dll
Installed v2/mysql.data.dll into the gac (/usr/local/lib/mono/gac)

I verify that it updated the GAC:

$ ls /usr/local/lib/mono/gac/MySql.Data/6.3.5.0__c5687fc88969c44d/mysql.data.dll

I get the following error when I run the application:

Failed to find or load the registered .Net Framework Data Provider MySql.Data.MySqlClient

I created a simple command line application described here: http://www.mono-project.com/MySQL, which works under Mono and .NET on my Windows machine, but does not work on my Linux box.

+1  A: 

As far as you added to GAC mysql.data.dll, are you sure you're referencing exactly it or maybe MySQL.Data.dll? Linux has case-sensitive file system so references resolutions is too

abatishchev
+1  A: 

There are two problems:

  1. The casing of the DLL as already mentioned.
  2. The machine.config needed to be updated. I didn't need to do this on the windows side because the MySql provider does this for you automatically.

To update your Mono machine.config files, you'll want to find your machine.config file. In the case of Cent OS, they are located in (/usr/local/etc/mono/2.0/machine.config). I just copied the stuff from my Windows .NET machine.config file to my mono one and it worked.

<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

Frankenspank