Error Connecting to Access Database

7 visualizaciones (últimos 30 días)
Jim
Jim el 28 de Ag. de 2014
Respondida: Bereketab Gulai el 20 de Mayo de 2020
I am attempting to connect to a MS Access database from Matlab Ver 7.12.0.635 (2011a) but I get an error in con.Message. I performed the following:
dbpath='C:\Users\g553586\Documents\Database1.accdb';
url = [['jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DSN='''';DBQ='] dbpath];
con = database('','','','sun.jdbc.odbc.JdbcOdbcDriver', url);
con
con =
Instance: ''
UserName: ''
Driver: []
URL: []
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: '[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified'
Handle: 0
TimeOut: []
AutoCommit: 'off'
Type: 'Database Object'
  1 comentario
Geoff Hayes
Geoff Hayes el 28 de Ag. de 2014
Jim - have you added the JDBC driver to the java static path? See MS SQL Server JDBC Windows for an example.

Iniciar sesión para comentar.

Respuestas (2)

Jim
Jim el 8 de Sept. de 2014
I attempted a different configuration. I defined an ODBC connection to an Access database test.accdb. and called it test_db. In the Matlab command window, I performed the following:
conn = database('test_db','','');
conn.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.
I researched the error message in Matlab help and found the following: "You tried to open a 32-bit application when running MATLAB® in 64-bit mode." and recommended resolution "Restart MATLAB to run in 32-bit mode using the command matlab –win32." However, when I run that command, Matlab always appears to run in 64-bit mode and I continue to get the same error message. I cannot find any other information on running in 32-bit mode. BR Is there another way to force running in 32-bit mode so that I can connect to the 32-bit Access db? Is there another work around? I am running this on a machine that is fairly locked down so I will have to go through a help desk to make changes to the installation.
  1 comentario
Jim
Jim el 8 de Sept. de 2014
I requested the 32-bit version of Matlab to be installed. I will have to wait a couple days for that to happen. If there is another work around, please post it. Thanks.

Iniciar sesión para comentar.


Bereketab Gulai
Bereketab Gulai el 20 de Mayo de 2020

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by