How to use Database Toolbox to query ACCDB/MDB file programmatically without JDBC/ODBC bridge on Windows
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 29 Mar 2018
Modifié(e) : MathWorks Support Team
le 17 Juin 2019
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?
Réponse acceptée
MathWorks Support Team
le 18 Juin 2019
Modifié(e) : MathWorks Support Team
le 17 Juin 2019
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Database Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!