The most recent major error I have encountered is with the MySQL database connection. An exception is thrown with the following message while executing Open() method of OdbcConnection.
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
My connection string looks something like this
DRIVER={MySQL ODBC 3.51 Driver};Database=my_db_name;Server=localhost;UID=my_user_name;PWD=my_password
So what to do?
First check the MySQL server and make sure the database and the database user specified in the connection string exist. If the database and user exists, then the problem must be with the MySQL odbc driver.
So download and install the MySQL odbc driver from MySQL website. Make sure you are downloading the same version of the driver that is specified in the connection string. Here in my case the odbc version is 3.51. MySQL odbc 3,51 driver is available here.
After the successfully installing the driver, try running the project again and the connection error will be gone.
If you installed 64 bit version of the driver and the issue still exists, then try installing the 32 bit version.
I installed the 32bit (x86) version of odbc driver even though my computer was running on 64 bit OS.
So in short, install the MySQL ODBC driver having the exact version as specified in the connection string
Comments
Post a Comment