How to configure an ODBC data source programmatically?

3 views (last 30 days)
Hello.
I need to query data from a Microsoft Access database. I can easily set up an ODBC data source with the Database explorer and then query it either with the same app or with code. . Unfortunately, the database is split into hundreds of .mdb files, so in order to query them, I'd need to set up hundreds of ODBC data sources manually. Is there a way to set up the data sources programmatically? Or alternatively, is there a way to query the contents of an .mdb file without having to set it up as an ODBC data source first?
Thank you.
  4 Comments
Antonio
Antonio on 25 Aug 2023
Update: I just solved the issue. While the dialog did not work for me (firewall issues?), I made it work by modifying the Windows registry entry associated with the data source I was trying to create. I added a DBQ String value pointing to one of the .mdb files in the network location. After modifying it like that, and connecting to this data source, all the other files on the same folder as the one I selected show up as "catalogs" for this data source, so I can just select any of them.
Thank you.
Kojiro Saito
Kojiro Saito on 28 Aug 2023
Thank you for the update. Happy to hear that the issue was solved.

Sign in to comment.

Answers (0)

Tags

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!