4

How do I connect to a 64 bit system DSN from a 32 bit application? I get the error: ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

OdbcConnection con = new OdbcConnection();
con.ConnectionString = string.Format("DSN={0}", _dsnName); 

I've seen lots of posts where people use 64 bit to connect to 32 is there a way to go from 32 to 64 without redefining your ODBC Connection using the 32 bit app? c:\windows\syswow64\odbcad32.exe

Pat
  • 627
  • 1
  • 9
  • 24

2 Answers2

1

A 'prefer32bit' exe, calling a 64bit dll. Solutions:

  1. CorFlags.exe SampleIntegration.exe /32BITPREF-
  2. Untick 'prefer 32 bit' in VisualStudio
  3. Compile to 64 bit
OzBob
  • 4,227
  • 1
  • 39
  • 48
0

If you are able to you should consider compiling your app for Any CPU which will allow it to run as a 64 or 32 bit app depending on what HW it is run on.

For a very good detailed article about bitness differences see Scott Hanselman's blog post about this.

Kevin
  • 4,586
  • 23
  • 35
  • 1
    There is an option for Prefer 32bit in Visual studio 2012, unchecking that defaults to 64 bit. Compiling it in 32 bit doesn't solve the problem, good guess though. – Pat Oct 15 '13 at 23:57