Thursday, 10 September 2015

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Problem:

When i tried to connect MS Access database. I am getting an error "ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". I am using below C# code to connect MS Access .mdb file using Odbc Connection.
using (OdbcConnection myConnection = new OdbcConnection())
{
    myConnection.ConnectionString = @"Driver={Microsoft Access Driver (*.mdb)};" + "Dbq=C:\\test.mdb";
    myConnection.Open();    
};

Solution 1:

The ODBC Driver Manager is supported only 64 bit application, so, we have to force our application to build in 32 bit mode.

Solution 2:

The problem solved for me after changing my C# project's build configuration to x86 platform. If you faced this error from IIS service, do the below steps to fix the problem.
  • Go to IIS and Application Pools in the left menu.
  • Right-click on the problematic Application Pool.
  • Click Advanced Settings. 
  • In General Tab, make the Enable 32 Bit Applications entry to "True"
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


Advertisements
Advertisements

No comments:

Post a Comment