# How can I connect to a database using the 32 Bit ODBC on a Windows 7 (64 Bit) machine?

I am having difficulties using a DSN that was defined in the 32 Bit version of the ODBC-manager? (there are two separate managers for 32/64 Bit on a 64 Bit machine)

Using the DatabaseLink package will give an error as the DSN is not found and unfortunately I cannot find how to make it use the 32 Bit ODBC in the documentation.

-
What error are you getting? – Verbeia Apr 18 '12 at 10:29
This may become messy. We had a related problem and only solved it by switching to a freshly setup 64bit machine. Can you delete the 32bit ODBC DSN and try with a new 64bit one? – Yves Klett Apr 18 '12 at 10:58
In[160]:= conn = OpenSQLConnection[JDBC["odbc", "accessDatabase"]] (* where "accessDatabase" is a 32bit DSN *) During evaluation of In[160]:= JDBC::error: [Microsoft][ODBC Driver Manager] Der angegebene DSN weist eine nicht übereinstimmende Architektur von Treiber und Anwendung auf.>> (Translation: DSN does not have a compatible architecture with regard to the driver.) This is to reproduce the error; for further comments please refer to the Answer 1 where I have commented also. Thanks. – gwr Apr 18 '12 at 14:31

It is not Mathematica that needs to run in 32-bit mode, but rather the Java runtime used by J/Link. To force the use of a 32-bit JVM, you can do as follows. You probably already have a 32-bit Java installed at the following location, and if not, you can install one from java.com. Needs["JLink"]; ReinstallJava[CommandLine->"C:\\Program Files (x86)\\Java\\jre7\\bin\\javaw"]. This is the J/Link equivalent of the Force32Bit` option that is in .NET/Link. – Todd Gayley Jul 31 '13 at 15:53