Click here to Skip to main content
15,909,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to connect my windows c# project to MySql. So to do this is it mandatory to install "mysql connector" or there is any alternative solution?
Posted

Well you do need some kind of database driver underneath. And if you don't want MySQL connector, then you'd need something equivalent to that.

I don't remember clearly, but in the old days, I believe I have used C drivers (which can be statically linked). So if distribution is your problem, write a C DLL that statically links to the required driver libs, and then you can P/Invoke this from your C# code. (my memory is not what it used to be, so I am not sure if I wrote this for MySQL or for PostgreSQL)
 
Share this answer
 
Comments
Espen Harlinn 7-Feb-11 14:28pm    
Good answer, he could even use C++/CLI :)
Yes, you will need the MySQL connector. See detail here http://bitdaddys.com/MySQL-ConnectorNet.html[^]

and sample project @ MySQL 5 C# sample code using ObjectDataSources[^]
 
Share this answer
 
Hi,
You can download the the mysql.data.dll from this links
----------------------------------------------------------
http://dev.mysql.com/downloads/mirror.php?id=393489#mirrors

http://dev.mysql.com/downloads/connector/net/1.0.html#downloads
----------------------------------------------------------
and put it in the bin folder.
Using this namespace
----------------------------
using MySql.Data.MySqlClient;
----------------------------
u can use mysql similar to ms sql.
If u want to configure sqldatasource with mysql u should install
mysql connector.

Regards,
vishak
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900