Question

I was always connecting to SQL which was simple, but now I would need to connect to a MySQL server. I thought System.data.odbc connection will work, but it doesnt connect. I do not udnerstand whather I really need to download and install any third party stuff like Connector or even MyODBC, I thought ODBC in .NET is enough. Could you please advice?

So far I am using:

 string ConString = @"driver={MySQL ODBC 3.51 Driver};server=localhost;database=db;uid=band;pwd=letmein;";
                dbconn.ConnectionString = ConString;
dbcon.Open();

Thank you in advance.

Was it helpful?

Solution

There are various possibilities to connect to a MySQL database. A list of them (and the necessary connection strings) can be found on this excellent site: http://www.connectionstrings.com/mysql

Edit: Since you're trying to avoid third-party connectors (even though I recommend them, because they were written specifically for the target db), you should look out for ".NET Framework Data Provider for OLE DB" or ".NET Framework Data Provider for ODBC" in the list

OTHER TIPS

You need either a odbc driver for MySQL or a .Net Framework Class to use (ie MySql.Data.MySqlClient.MySqlConnection)

.Net and Windows doesn't include native support for MySQL

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top