* Nix mono cannot find mysql. Data cocould not be loaded

Source: Internet
Author: User

----------------------------------------------------

Update:

When I first encountered this problem, I thought that the file name is case sensitive due to Unix systems. During this time, I checked Mono'sSource code, Find the source code, more intuitive.

The underlying mono library uses eglibc, which is used to access files. Of course, the UNIX standard library must be case-insensitive.

 

LoadProgramSet:

 

Static monoassembly * real_load (gchar ** search_path, const gchar * culture, const gchar * Name, gboolean refonly) {monoassembly * result = NULL; gchar ** path; gchar * filename; const gchar * local_culture; Gint Len; gboolean is_private = false; If (! Culture | * Culture = '\ 0') {local_culture = "";} else {local_culture = culture;} filename = g_strconcat (name ,". DLL ", null); Len = strlen (filename); For (Path = search_path; * path; Path ++) {If (** Path = '\ 0 ') {is_private = true; continue;/* ignore empty applicationbase */}/* See test cases in bug #58992 and bug #57710 * // * 1st try: [Culture]/[name]. DLL (culture may be empty) */strcpy (filename + len-4 ,". DLL "); If (try_load_from (& result, * path, local_culture," ", filename, refonly, is_private) break;/* 2nd try: [Culture]/cmdname.exe (culture may be empty) */strcpy (filename + len-4 ,". EXE "); If (try_load_from (& result, * path, local_culture," ", filename, refonly, is_private) break;/* 3rd try: [Culture]/[name]/[name]. DLL (culture may be empty) */strcpy (filename + len-4 ,". DLL "); If (try_load_from (& result, * path, local_culture, name, filename, refonly, is_private) break;/* 4th try: [Culture]/[name]/cmdname.exe (culture may be empty) */strcpy (filename + len-4 ,". EXE "); If (try_load_from (& result, * path, local_culture, name, filename, refonly, is_private) break;} g_free (filename); return result ;}

File judgment:

 

 

 
Gbooleang_file_test (const gchar * filename, gfiletest test) {struct stat st; gboolean have_stat; If (filename = NULL | test = 0) return false; have_stat = false; if (Test & g_file_test_exists )! = 0) {If (access (filename, f_ OK) = 0) return true;} If (Test & g_file_test_is_executable )! = 0) {If (access (filename, x_ OK) = 0) return true;} If (Test & g_file_test_is_symlink )! = 0) {have_stat = (lstat (filename, & St) = 0); If (have_stat & s_islnk (St. st_mode) return true;} If (Test & g_file_test_is_regular )! = 0) {If (! Have_stat) have_stat = (STAT (filename, & St) = 0); If (have_stat & s_isreg (St. st_mode) return true;} If (Test & g_file_test_is_dir )! = 0) {If (! Have_stat) have_stat = (STAT (filename, & St) = 0); If (have_stat & s_isdir (St. st_mode) return true;} return false ;}

 

------------------------------------------------------------

 

Today, I tried to use mono to access MySql in Linux.

Ado. Net driver for MySQL (http://www.mysql.com/downloads/connector/net/) is officially provided. Something is simple, a few DLL files, and a msdn style CHM document file.

 

There is always a problem when running the program. The prompt is:

The following Assembly referenced from test.exe cocould not be loaded:
Assembly: mysql. Data (assemblyref_index = 1)
Version: 6.2.3.0
Public Key: c5687fc88969c44d

The Assembly was not found in the Global Assembly Cache, a path listed in the mono_path environment variable, or in the location of the executing assembly

 

However, I have already added references, and the official MySQL is in the directory. data. DLL. I tried it several times, so I guess it is not a clear file, because the file name in * nix is case sensitive.Changed to MySQL. Data. dll..

 

I don't know what the problem is. Check Mono'sCodeHow should it be his problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.