Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

32-bit and 64-bit and DB issues, oh my!

Asked by David Goldsmith on 17 May 2012

Hi! Just had my platform upgraded to Win7 64-bit (from 32-bit XP). Trying to get my database toolbox stuff to work. After failing w/ 64-bit R2012a, I installed 32-bit R2011b, which is what I was using before the upgrade, i.e., under which everything worked fine. Here's the output of ver:

>> ver
-------------------------------------------------------------------------------------
MATLAB Version 7.13.0.564 (R2011b)
MATLAB License Number: xxxxx
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
-------------------------------------------------------------------------------------
MATLAB                                                Version 7.13       (R2011b)
Database Toolbox                                      Version 3.10       (R2011b)
SEAWATER Library                                      Version 3.2                
Signal Processing Toolbox                             Version 6.16       (R2011b)

(Note the absence of 64-bit in the Java info line; the About window also indicates I'm running a 32-bit MATLAB, but these posts don't allow screenshots, so you'll just have to take my word for it. :-) )Here's the info on the SQL Server driver I'm using, courtesy of odbcad32.exe:

SQL Server Version 6.01.7601.17514 File SQLSRV32.DLL

In other words, AFAICT, I am using a 32-bit Matlab and a 32-bit ODBC driver. Now, here's what I get when I try to establish a MATLAB connection to a database I have no trouble connecting to using SQL Server Management Studio:

>> DB = database('EAPMW','','');
>> DB.Message
ans =
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application Please verify that login information and database url are valid.

When I search the MathWorks Web site for "DSN contains an architecture mismatch," all I get is 'make sure the bit-version of your MATLAB matches the bit-version of yur ODBC driver.' Any other ideas? Thanks!

2 Comments

Geoff on 18 May 2012

What happens if you install the 64-bit ODBC driver?

Andreas Goser on 10 Sep 2013

FYI, I xxxed out the license number...

David Goldsmith

Products

2 Answers

Answer by Juan B. Gutierrez on 18 May 2012
Accepted answer

There are two ODBC managers availabe to you:

%windir%\system32\odbcad32.exe

and

%windir%\SysWOW64\odbcad32.exe

One manges 32-bit ODBCs and the other 64-bit ODBCs. Try creating your DSN in both 32 and 64 bit versions of the ODBC manager. Additionally, you might want to check the answer at: http://www.mathworks.com/matlabcentral/answers/37595-how-can-i-read-database-from-database-row-by-row

Hope that helps. Good luck.

3 Comments

David Goldsmith on 18 May 2012

Yup, I needed to run the SysWOW, which I didn't know about, thanks!!! From what I read elsewhere: my only hope of getting things to work w/ 64-bit MATLAB is to switch to JDBC, correct? Thanks again!

Juan B. Gutierrez on 19 May 2012

David, I am glad this answer helped you :) I am not familiar with the database toolbox, even though I access heterogeneous databases routinely from MATLAB (e.g. MySQL, SQL Server, Oracle, Posgres). I use .NET within MATLAB to do that (that is the link I posted in my initial answer). I find the .NET libraries to access ANY database to be very powerful and complete. You could do the same with Java classes. Therefore, you have many avenues to access your database.

Keith Phillips on 10 Sep 2013

Should I be able to use .NET to connect to a 32bit version of Access with a 64bit version of Matlab?

Juan B. Gutierrez
Answer by Thomas Vargas on 5 Dec 2012

Getting the JDBC Drivers to work right is really really complicated and almost not worth it.

0 Comments

Thomas Vargas

Contact us