Code covered by the BSD License  

Highlights from
Matlab to MySQL Interface

3.0

3.0 | 1 rating Rate this file 29 Downloads (last 30 days) File Size: 82 KB File ID: #15002
image thumbnail

Matlab to MySQL Interface

by Luigi Rosa

 

15 May 2007 (Updated 16 May 2007)

Matlab to MySQL interface using a PHP script

| Watch this File

File Information
Description

MySQL is an open-source database server designed for robustness and speed. On the MySQL home page you can read all about it. To interface to the server, you need a client program which implements the specific MySQL protocol. Then you can execute queries using standard Structured Query Language (SQL). For mathematical and statistical analysis, the best way to use the data is to download it directly into Matlab (for example using Robert Almgren's interface available at http://mmf.utoronto.ca/resrchres/mysql/ ).

Unfortunately many web servers do not allow users to access MySQL server from remote applications for safety reasons. In this case this limitation can be solved interfacing MySQL server with a php script called by Matlab application.

The php script executes the list of MySQL commands given by Matlab, and eventually returns also some output values (in case of SELECT command). This php script has to be available at the remote server (uploaded via FTP protocol). This php script receives the list of MySQL commands submitted by Matlab using POST method. Matlab in fact can read the content of an URL passing information to the server as part of the request with GET or POST methods using urlread command.

Index Terms: Matlab, source, code, php, MySQL, interface, interfacing, database, SQL, connection, server, http, request, script.

For more details please visit

http://www.advancedsourcecode.com/matlabphpmysql.asp

Luigi Rosa
Via Centrale 35
67042 Civita Di Bagno
L'Aquila - ITALY
mobile +39 320 7214179
web site http://www.advancedsourcecode.com

MATLAB release MATLAB 7.2 (R2006a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
19 May 2007 Dimitri Shvorob

Just wondering: how common is the situation where a 'web server does not allow users to access MySQL server from remote applications for safety reasons', yet accepts an upload and execution of a PHP script? Also, let me add these two FEX links to the 'bibliography' :)
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8663&objectType=FILE
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=11913&objectType=FILE
 

19 May 2007 Dimitri Shvorob

IMHO, you might offer a little more help on how to use the code - for example, explain what 'test_input.m' and related files are doing, and what (simple?) modifications are needed for a user to run it. Current 'readme' merely repeats the FEX description. An HTML report would be helpful, and ensure that the test code actually works. Case in point: test_input.m has 'INSERT INTO tabella..' query, but 'tabella' - perhaps 'table'? - has not been created.

19 May 2007 Luigi Rosa

Hi Dimitri, thanks for your suggestions. For example my web server accepts queries only from php/asp scripts or using an internal GUI. The string "tabella" is the name of the an exisiting table. Of course, documentation can be improved. Luigi

30 Jul 2009 Ona

Hello Luigi,
Please can you explain the processes in using these files. I dont seem to know where to start or do with the files.

Thanks a lot in advance.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data import Luigi Rosa 22 Oct 2008 09:12:49
data export Luigi Rosa 22 Oct 2008 09:12:49
mysql Luigi Rosa 22 Oct 2008 09:12:49
php Luigi Rosa 22 Oct 2008 09:12:49
script Luigi Rosa 22 Oct 2008 09:12:49
sql Luigi Rosa 22 Oct 2008 09:12:49
interfacing Luigi Rosa 22 Oct 2008 09:12:49
database Luigi Rosa 22 Oct 2008 09:12:49
interface Luigi Rosa 22 Oct 2008 09:12:49
php marwan salih 30 Nov 2008 10:50:58
data export Ramananda Sahu 12 Apr 2009 01:05:05

Contact us at files@mathworks.com