Error Accessing MS Access Database in Script Run from Command Prompt

1 Ansicht (letzte 30 Tage)
Jim
Jim am 7 Apr. 2016
Bearbeitet: Jim am 7 Apr. 2016
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 Kommentare
Walter Roberson
Walter Roberson am 7 Apr. 2016
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 am 7 Apr. 2016
Bearbeitet: Jim am 7 Apr. 2016
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by