3

I have a Win32 application that makes ODBC-Connections. We connect using SQLDriverConnect() which displays a dialog to select the data source. In the x64-Version the Dialog shows and offers 2 different 32 Bit MS ACCESS Drivers. When i select one of these, in the 32 Bit version i would see a open file dialog to select a .mdb file. In the 64 Bit version the call to SQLDriverConnect() at this point returns with -1.

SQLError() returns: "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"

Is it in general possible to use a 32 Bit ODBC Driver from a 64-Bit executable? Why are these driver shown? As far as i can find there is no 64 Bit MS Access OBDC driver so far. What can i do?

RED SOFT ADAIR
  • 12,032
  • 10
  • 54
  • 92

4 Answers4

6

You absolutely cannot mix 32bit application and 64bit driver (or vice-versa).

Basically, an ODBC driver is, typically, a dll (windows) or a shared object (linux...) which is loaded by its parent application.

All executables, dlls, etc that share the same process space must be the same bit'ness...

Garry M. Biggs
  • 279
  • 1
  • 1
  • Thanks for that clear answer. I was nut sure if ODBC uses COM or different interfaces. But why are these drivers listed by the ODBC driver manager when i call it from a 64-Bit Application? – RED SOFT ADAIR Apr 12 '11 at 13:14
  • @REDSOFTADAIR It has to do with registry entries. The Microsoft description is here: http://support.microsoft.com/kb/942976 – jvangeld Mar 26 '12 at 22:36
2

In order to "bridge" from a 64bit application to a 32bit ODBC driver you would need to employ an ODBC to ODBC Bridge such as -

http://uda.openlinksw.com/odbc-odbc-mt/

This has a 64bit ODBC client component which connects vis sockets to 32bit server components. The server components bridge to a pre-configured 32bit Access ODBC DSN.

Client component can be either on the local machine or a server machine...

Garry M. Biggs
  • 279
  • 1
  • 1
0

Well, I don't know why SQLDriverConnect() works the way you describe it, but perhaps this Blog post from Microsoft

http://blogs.msdn.com/b/psssql/archive/2010/01/21/how-to-get-a-x64-version-of-jet.aspx

can help you a little bit.

Seems there will be no native 64 bit ODBC driver for MS Access in near future, but those ACE components mentioned there may be an alternative.

Doc Brown
  • 19,739
  • 7
  • 52
  • 88
  • The 64bit Office or MS Access 2010 installers do include a 64bit MS Access ODBC Driver, although it is not part of the 64bit MDAC shipped with the 64bit Windows OS'es it seems, although I imagine that may change in later updates. Only last week I installed 64bit MS Access which then enabled me to Link MS Access tables into my 64bit [Virtuoso Server](http://virtuoso.openlinksw.com) on Windows. – hwilliams Apr 12 '11 at 23:57
  • @hwilliams: thanks for that interesting info, seems the blog post I found is a little bit outdated. – Doc Brown Apr 13 '11 at 06:27
-2

You can't, but you have the alternative to compile your app in 32bits, and use the 32bit odbc driver. In my case, I use GoLang just change GOARCH environment variable SET GOARCH=386 then compile your project go build and your all set.