Wiki

Changes between Initial Version and Version 1 of SetUpMySqlOnUnixLike

Show
Ignore:
Timestamp:
06/20/09 10:20:14 (15 years ago)
Author:
Chuck
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SetUpMySqlOnUnixLike

    v1 v1  
     1This guide will show you how to set up MySQL access for NovellMono on UnixLike systems. 
     2 
     3This guide assumes that: 
     4 * You are on a UnixLike box (Mac, Linux, etc.) 
     5 * You have installed the MySQL server 
     6 * You have started the MySQL server 
     7 * Have installed Cobra 
     8 * Have downloaded the MySQL connector for .NET to a directory called Packages 
     9 
     10From the command line: 
     11{{{ 
     12mkdir mysqlcon 
     13cp Packages/mysql-connector-net-6.0.4-noinstall.zip mysqlcon/ 
     14cd mysqlcon 
     15unzip mysql-connector-net-6.0.4-noinstall.zip 
     16cat README 
     17mv mysql.data.dll MySql.Data.dll 
     18gacutil -i MySql.Data.dll 
     19# or: 
     20sudo gacutil -i MySql.Data.dll 
     21    Installed MySql.Data.dll into the gac (/Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac) 
     22}}} 
     23 
     24If you like, you can "rm -rf" the "mysqlcon" directory as the .dll now resides in the GAC. You'll want to keep the original .zip around in case you need to install on another machine or reinstall. 
     25 
     26There are some other DLLs in there like mysql.data.cf.dll, mysql.data.entity.dll, mysql.visualstudio.dll and mysql.web.dll. I have not explored them other than to take a quick glance at the types contained therein. Everything I seem to need at this time is in the on DLL, MySql.Data.dll. 
     27 
     28The namespaces in MySql.Data.dll are: 
     29 
     30 * MySql.Data.Common 
     31 * MySql.Data.!MySqlClient 
     32 * MySql.Data.!MySqlClient.Properties 
     33 * MySql.Data.Types 
     34 * zlib 
     35 
     36You can use .NET Reflector or some other tool to explore the DLL in more detail. 
     37 
     38Let's try it out. 
     39{{{ 
     40$ cd /usr/local/cobra/current/HowTo/ 
     41$ cobra -ref:System.Data -ref:MySql.Data 600-AccessMySQL.cobra  
     42(0): error: cannot find metadata file "MySql.Data.dll" (C#) 
     43Compilation failed - 1 error, 0 warnings 
     44Not running due to errors above. 
     45}}} 
     46 
     47Well that's not very exciting. Let's try the full path: 
     48{{{ 
     49$ cobra -ref:System.Data \ 
     50  -ref:/Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac/MySql.Data/6.0.4.0__c5687fc88969c44d/MySql.Data.dll \ 
     51  600-AccessMySQL.cobra  
     52userName=root, host=localhost 
     53userName=root, host=mycomputer.local 
     54userName=, host=mycomputer.local 
     55userName=, host=localhost 
     56}}} 
     57 
     58Look at the source code for 600-AccessMySQL.cobra to see how basic queries are done. 
     59 
     60At this point, I don't know why the absolute path is required given that the DLL was installed to the GAC. But you can bury this ugly detail in a build script. 
     61 
     62See also: ADO.NET, ActiveRecord