Feed on
Posts
Comments

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.

Stumble it!

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

5 Responses to “how to get matlab to talk to mysql”

  1. on 10 Mar 2006 at 3:41 pm Christian Lepple

    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

  2. on 17 Mar 2006 at 4:26 am Anonymous

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

  3. on 22 Sep 2007 at 2:59 pm Stephen Killingsworth

    I agree, this description is incredibly helpful!

    Thanks,
    -Stephen

  4. on 23 Jan 2008 at 7:58 am Ian

    Anyone got a compiled version of the above working?
    Seems like it is troublesome to set the classpath…

    In particular, the error:
    Undefined variable: “com.mathworks.toolbox.database.databaseConnect”

    Ian.

  5. on 30 Aug 2008 at 11:35 pm mahmud

    i faced an eror

    Undefined variable: “com.mathworks.toolbox.database.databaseConnect”

Did I get this wrong? Let me know!

Trackback URI | Comments RSS

More blogs about http://desk.stinkpot.org:8080/tricks.