View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.0 | 6 ratings Rate this file 6 Downloads (last 30 days) File Size: 9.14 KB File ID: #9549 Version: 1.0




07 Jan 2006 (Updated )

Exchange blobs (binary large objects) with MySQL databases

| Watch this File

File Information

MYBLOB_DEMO - Demonstrate the use of the MYBLOB tool kit
MYBLOB_OPEN - Open the connection to a MySQL database
MYBLOB_COMMAND - Send an SQL statement to a MySQL database
MYBLOB_FROM_DB - Retrieve a blob (binary large object) from a MySQL database
MYBLOB_TO_DB - Send a blob (binary large object) to a MySQL database
MYBLOB_CLOSE - Close the connection to the MySQL database

* Install MyODBC from
* Insert your own MySQL database parameters in myblob_demo.m
* Run myblob_demo


My Sql Database Connector inspired this file.

This file inspired Myblob Testdb, Adodb Tools, and Access A My Sql Database.

MATLAB release MATLAB 7.1.0 (R14SP3)
Other requirements MySQL Connector/ODBC (aka MyODBC) from
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
17 May 2014 AAlejandroVR

It Works very well, but i have some issues, i'm trying to store a text File. so what I need to change in this code?

11 Oct 2012 Milou

Milou (view profile)

When running myblob_command, i get the following error.

Error using COM.ADODB_Recordset/Open
Invoke Error, Dispatch Exception:
Source: ADODB.Recordset
Description: The connection cannot be used to perform this operation. It is either
closed or invalid in this context.
Help Context ID: 12ee52

I have not figured out a way to fix this


Comment only
10 Apr 2012 Pavel M.

Selection and insertion from/to database work great with the uploaded functions! Thank you

06 Apr 2012 Pavel M.

what is command_text should be in myblob_to_db (ado_connection, table, column, where, file) function ?

Comment only
29 Mar 2012 Joseph Burgel

Nice. I was wondering if anybody has tried to write to a BLOB not from a file but directly from a Matlab matrix variable? Say, a 5x5 double matrix? Skip writing to a .mat and reading back out of the file to save time?

Comment only
03 Nov 2009 M Koelemay

Additionally, to allow this to work from 64-bit Matlab, install the 64-bit version of MSDASQL via a Microsoft hot fix (link below) and add "provider=MSDASQL" to the connection string


Hot fix:

25 Oct 2008 Joerg Buchholz

@Lucy: Matlab 2008b seems to work with the MySQL ODBC 3.51 Driver and the MySQL ODBC 5.1 Driver. If you want to use the MySQL ODBC 5.1 Driver you have to change line 22 in myblob_open.m from
'driver=MySQL ODBC 3.51 Driver; ' ...
'driver=MySQL ODBC 5.1 Driver; ' ...

Comment only
06 Oct 2008 Lucy Matlab

using Matlab 2008a and MySql 5.0 for Win32:

??? Invoke Error, Dispatch Exception:
Source: Microsoft OLE DB Provider for ODBC Drivers
Description: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Error in ==> myblob_open at 40

Error in ==> myblob_demo at 26
connection = myblob_open (user, password, server, database);

Comment only
08 May 2008 Brian McFee

Beware, this only seems to work on windows.

20 Sep 2006 none none

nice, just what I was looking for.

23 Jun 2006 Michael Ewens

Works well, even if you don't need blob capability.

Contact us