No BSD License  

Highlights from
Access a MySQL database

4.0

4.0 | 1 rating Rate this file 45 Downloads (last 30 days) File Size: 20.6 KB File ID: #17897
image thumbnail

Access a MySQL database

by

 

05 Dec 2007 (Updated )

(with mym.m)

| Watch this File

File Information
Description

The submission collects several small utilities 'wrapping' Yannick Maret's 'mym' Matlab/MySQL interface, available from

http://sourceforge.net/projects/mym

Their application is illustrated by script mydemo.m, which uses the FEX download data presented in FEX submission 'A week on File Exchange'. First, we read the data (6 mixed-type columns, over 1 million rows) from a text file into a MySQL table, using 'load infile', passed through the basic mym interface. Next, we retrieve the table's structure and contents into Matlab workspace using TBATTR and TBREAD, and take the data back to MySQL with TBWRITE.

We observe that text-file-mediated exchange, accommodated on MySQL's side by 'load infile' and 'select into outfile', is a vastly superior option for large datasets; TBREAD and TBWRITE (the latter operating through multiple-row 'insert values' flushes) are more convenient for small datasets with many columns.

Acknowledgements

My Sql Database Connector, Myblob, A Powerful Sidekick: Using My Sql For High Volume Data Manipulation In Matlab, The Twain Shall Meet: Facilitating Data Exchange Between Sas And Matlab, and Analyze Fex Download Data inspired this file.

This file inspired My Sql Shortcut Files and Query My Sql.

MATLAB release MATLAB 7.2 (R2006a)
Other requirements mym Matlab/MySQL interface
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
04 May 2010 Dadi Gudmundsson

Overall I find this useful and good. Reason for less than perfect rating is:
1) These wrapper files tend to replace more detailed mym error messages with their own. Easy to fix.
2) For some datasets the s string created in TBWRITE line 79 ends in a comma and a space. This means that line 80 doesn't remove the comma at the end. This then gives an SQL error. Haven't figured out why some datasets do this, but not others. Pretty easy to fix.
Cheers
dadigu

16 Mar 2010 Howard Bussey

I'm trying to use a MySQL server that is on a non-standard port (not 3306) and mym doesn't connect. I can use the MySQL browser to see the databases that server manages, so I know the server is running and listening on the non-standard port. I also tried specifying port 3306 (standard) for a server with the standard configuration - that didn't connect either.

Has anyone else tried specifying a port in the connection string? Did it work for you?

Contact us