Why do I receive an 'Invalid connection' error message when trying to establish a Dynamic Database Source Name (DSN) Connection to Access within Database Toolbox 3.10 (R2011b)?

6 views (last 30 days)
I want to establish a connection to a Dynamic Database Source Name (DSN) to an ACCDB file format Access 64-bit using Database Toolbox 64-bit. But when I run the following code, based on the instructions indicated in the documentation:
dbpath = ['C:\Data\Matlab\MyDatabase.accdb'];
url = [['jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ='] dbpath];
con = database('','','','sun.jdbc.odbc.JdbcOdbcDriver', url);
I receive an 'Invalid connection' error message.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Jan 2013
The below example has been incorporated into the documentation in Release 2012b (R2012b). For previous releases, read below for any additional information:
This error occurs due an error in the URL syntax. To connect to an Access database which has an ACCDB file format, please use the following form instead:
url = [['jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DSN='';DBQ='] dbpath];

More Answers (0)

Products


Release

R2011b

Community Treasure Hunt

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

Start Hunting!