1
votes

I have searched this for several days now (including trying the solution from one link from this site) and I still cannot get this to work...

Problem: I converted an old Visual Studio 2005 project to 2010 on a Windows 7, 64 bit box. Everything works fine, including my ODBC connection to an Oracle database...however, I cannot connect to a mySQL database like I could with VS 2005 on a WinXP 32 bit box.

What I've tried: Uninstalling the 64 bit ODBC driver for MySQL with a 32 bit driver. I added this to my System DSN and the test connection works fine (from odbcad32.exe). All other instances of this driver are removed from the User DSN from both odbcad32 and the 64 bit odbc client. I cannot continue my project without accessing this database. I have tried everything from every website thread, and I still cannot find a solution.

I get this error:

The thread '' (0x1648) has exited with code 0 (0x0). A first chance exception of type 'System.Data.Odbc.OdbcException' occurred in System.Data.dll An ODBC exception occurred: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified A first chance exception of type 'System.NullReferenceException' occurred in App_Web_uoi23wal.dll

This is the connection string I am using:

mySqlConnectionString = "Driver={MySQL ODBC 5.1 Driver};Server=xx.xxx.xx.xx;Port=3306;Database=xxxx;User=xxxx;Password=xxxx;";

Can anyone please help me with this? I am at my wit's end! ;)

Thanks!

2
You can get a 64 bit driver here dev.mysql.com/downloads/connector/odbcFionnuala
Hello all. I already tried the link you posted. None of the advice worked for me. Also, the 64 bit driver was the first thing I tried and I could not get it to work. The link that Naveen posted is exactly what I tried earlier today, even with the 32 bit driver, and I still get this error.Robert Brooks
Can you open the "ODBC Administrator" control panel option on the new Win7 box and check the exact mysql ODBC driver name (it will be listed in Drivers tab). Something tells me that it will be called MySQL ODBC 5.2 Driver}.....cha
It reads "MySQL ODBC 5.1 Driver".Robert Brooks

2 Answers

4
votes

Couldn't find anyone else who has solved this, but I tried this and both worked for me. Original post is old but if anyone else reads this, possible solution for you.

"Driver={MySQL ODBC 5.2 ANSI Driver}; Server=localhost; Database=***; User=****; Password=****; Option=3;"
"Driver={MySQL ODBC 5.2 Unicode Driver}; Server=localhost; Database=***; User=****; Password=****; Option=3;"

Seems like you must actually specify the 'ANSI' or 'UNICODE' string instead of the 'w' or 'a' as has been suggested on other forums and threads. I presume its no coincidence that it is specified exactly like that in the ODBC Data Source Administrator menu (Control Panel -> System -> Administrative Tools -> Data Sources (ODBC) -> Drivers)

0
votes

This worked for me on MySQL 5.1

Data Sources (ODBC): - User DSN : delete the specified User DSN - System DSN : create a new System DSN Make sure you have only System DNS not both..