Architecture mismatch when using ODBC

Today I ran into a problem when I was trying to connect to a data source using ODBC.  Currently I’m working on a web application that uses ASP.NET running on .NET Framework 2.0 and that has one connection to a SQL Server database and a number of other connections to databases based on Pervasive SQL. The web application uses ODBC to connect to the Pervasive SQL databases.

Ok, and now for the problem…

When I was trying to start the web application I got an error message saying “ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application”.

After a little investigation I found out that my Visual Studio project was compiled targeted towards the x64 architecture (64 bit) using ODBC drivers created for the x86 architecture (32 bit) which led to the error message. Apparently you need to have ODBC-drivers that is compiled for the same architecture as the application that uses them.

This is how I solved the problem and got my application up and running…

The first thing I did was to make sure that I had a valid ODBC connection, and since I’m running Windows 7 x64 (64 bit) I needed to open the old ODBC Data Source Administrator using the following path:



The WOW part in SYSWOW64 basically means Windows 32 bit on Windows 64 bit and is sort of a copy of the system32 folder created on the x86/32 bit architecture

I checked my ODBC connection and made sure that it was properly created.

Next thing – Visual Studio …

Ok, the ODBC connection seems to work and the next thing I had to do was to change the platform for the projects in my Visual Studio solution. First a little background: the solution contains five C# projects that are class libraries and two projects that are ASP.NET web site projects. The web sites has references to the class libraries and everything is created with default settings in Visual Studio, i.e. the platform is set to “Any CPU”. The web sites are configured to run using IIS and not Cassini, the ASP.NET development server used by Visual Studio.

Changing the target platform for the class libraries was easy and I simply just opened the properties for each project and changed the Platform target found under the Build tab in the Properties dialog.


When I tried to do the same thing with the The ASP.NET web site projects I discovered that that type of Visual Studio projects doesn’t have any setting for this. In order to make the web sites run on the x86 architecture I found out that this has to be done in Internet Information Services Manager (IIS).

Next and final thing – IIS

So, almost there! I started the IIS Manager (INETMGR) and expanded the node for Application Pools. This is where we get the possibility to tell the application what platform to run on. I selected the application pool used by my web site and clicked Advanced Settings in the right panel. The next thing I did was to alter the Enable 32-Bit Applications setting to true which basically means that my web site application should run as an application using the x86 (64 bit) architecture.



Problem solved!

I solved the problem following the steps above and my web site application is up and running.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s