How can I store a binary file in a database and retrieve it back using the Database Toolbox?

1 view (last 30 days)
I would like to store a binary file in a database and be able to write back the file afterwards using the Database Toolbox.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 30 Apr 2021
Edited: MathWorks Support Team on 30 Apr 2021
The attached example demonstrates how to read a binary file (a MAT file is used for this example) and insert it into a Microsoft Access database using the function FASTINSERT (see insertbindata.m).
The field to which the binary data is inserted is of type "OLE Object" and supports up to 1 GB of data:
​​​​​​​
The file readbindata.m contains code to retrieve the data from the database and write it back as a file.
Please note that the MS Access file may grow to a very large size after repeated DELETE and INSERT operations related to binary files. To work around this issue, you can use the option "Compact and Repair Database" to shrink the database to a minimum size.

More Answers (0)

Products


Release

R2009b

Community Treasure Hunt

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

Start Hunting!