Send As SMS

2/10/2006

how to get matlab to talk to mysql

i've been working on a gene identification / network modeling experiment for a couple of weeks now. i have tons of processed microarray data that now needs to be examined as well as further annotated by hand. since all the data has already been processed, a spreadsheeting package is unncessary; what i really need is a database to store all this information that doesn't fit neatly into fixed rows and columns.

unfortunately, the easiest piece (read, nicest GUI) of database software around, Microsoft Access, doesn't live on OS X. filemaker pro is also out, since i'd like to write perl scripts to interface with the database. next up was MySQL. this looked like a good option, especially since all the processed data currently lives in matlab; matlab advertises a database toolbox that eases transfer of data from matlab to MySQL.

here's how i figured out how to get this working (on mac OS X):

1) download and install mysql.

2) download the jdbc driver here.

3) open the classpath.txt file in [matlab path]/toolbox/local/ and add the following line to it:

[path to unzipped jdbc driver package]/mysql-connector-java-3.1.12-bin.jar
4) create a database in mysql (can look up here how to do that)

5) to connect to the database you've created (call it "foo"), type into matlab:
>> conn = database('foo','[your user name]','','com.mysql.jdbc.Driver','jdbc:mysql://localhost:3306/foo')
you can go ahead and try to use matlab's confds command; i spent over an hour trying to get it to work with no luck. i have no idea why the command-line option works but the GUI one doesn't.

6) start reading the sql and mathworks documentation, like i'm doing now, and learn how to be useful.

a note: this piece of documentation proved somewhat useful throughout this process; it's actually more informative than the most current page on the mathworks support site.


2 Comments:

Christian Lepple said...

Thank you very much for your detailed description how to connect Matlab to mysql with MAC OS 10.4. I have spent many useless hours to get it done. The problem was, there is a debuged JDBC driver (mysql-connector-java-3.1.12-bin-g.jar) that does not work. Maybe worth to know.

Best
Christian

3/10/2006 03:41:33 PM  
Anonymous said...

mabe you can try this http://itswww.epfl.ch/~maret/software.php

3/17/2006 04:26:32 AM  

Post a Comment

Links to this post:

Create a Link

<< Home

My blog has moved! Redirecting...

You should be automatically redirected. If not, visit http://stinkpot.afraid.org:8080/tricks/ and update your bookmarks.