Error Accessing MS Access Database in Script Run from Command Prompt

3 次查看(过去 30 天)
I created a User Data Source named Reduction in the ODBC Source Administrator using a Microsoft Access Driver (*.mdb, *.accdb) for a MS Access Database. Interactively in Matlab, I can successfully run the following without error:
conn = database('Reduction','','');
setdbprefs('DataReturnFormat','cellarray');
disp(qry);
rslts = fetch(conn,qry);
However, when I run a script containing those commands using the following at acommand prompt:
matlab -nodesktop -nosplash -r "run O:\run_spectra_plot_by_ms_access.m"
I get the error
??? Error using ==> database.fetch at 23
[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.
Error in ==> run_spectra_plot_by_ms_access at 7
rslts = fetch(conn,qry);
Why am I getting that error and how can I resolve it?
  3 个评论
Walter Roberson
Walter Roberson 2016-4-7
Could you verify that the version of MATLAB that you are getting when you run interactively is the same one that you get when you invoke matlab from the command line?
Jim
Jim 2016-4-7
编辑:Jim 2016-4-7
I just "discovered" (I had forgotten and re-discovered the two versions installed) that my machine has both the 32 and 64 bit versions of Matlab installed. Running matlab at the command prompt was running the 64 bit version. I modified the command by qualifying it to point the 32 bit version and the script ran normally. Yay. That was so frustrating.

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by