How to use Database Toolbox to query ACCDB/MDB file programmatically without JDBC/ODBC bridge on Windows

4 ビュー (過去 30 日間)
Starting R2017b, MATLAB Database Toolbox no longer supports JDBC/ODBC bridge because MATLAB starts using JRE version 8. How can I query ACCDB/MDB file on Windows with Database Toolbox?

採用された回答

MathWorks Support Team
MathWorks Support Team 2019 年 6 月 18 日
編集済み: MathWorks Support Team 2019 年 6 月 17 日
Please consider adding/removing the ODBC data source using command line options in Windows. Please refer to the following page from Microsoft for commands such as 'odbcconf' in command prompt or 'Add-OdbcDsn' in PowerShell:
Since 'odbcconf' is not recommended by Microsoft, please find the following example of using '<https://www.mathworks.com/help/matlab/ref/system.html system>' command in MATLAB to execute PowerShell command 'Add-OdbcDsn' with the following:
>> dbqfilepath = strcat("'dbq=", filepath, "'");
>> dbsource = strcat("powershell;Add-OdbcDsn -Name 'dbdemo' -DriverName 'Microsoft Access Driver (*.mdb, *.accdb)' -DsnType 'User' -Platform '64-bit' -SetPropertyValue ", dbqfilepath);
>> system(dbsource);
The above would help adding the datasource to ODBC and you may then use '<https://www.mathworks.com/help/database/ug/database.html database>' command for native ODBC connection.
To remove the data source, please refer to the following page from Microsoft for the 'Remove-OdbcDsn' PowerShell command:
An example command would look like the following:
system("powershell;Remove-OdbcDsn -Name 'dbdemo' -DsnType 'User' -Platform '64-bit'");

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by