Mathematica and MySQL Server

I often use Mathematica and MySQL together; it’s typically a lot more efficient than trying to keep megabytes of data in the Mathematica notebook itself, and becomes vastly more powerful if I want to use the same data from multiple machines, all of which can tap into the same database.

Mathematica supports these uses natively, and you can send arbitrary SQL code to the server with the SQLExecute command. Interestingly, Mathematica also provides commands that map to major SQL commands, including SQLSelect[] and SQLInsert[]. I have never used these, viewing it as easier to program SQL commands in SQL itself, tuning them in MySQL Workbench.

Today, it occurred to me that Mathematica’s built-in commands might somehow be quicker than sending raw SQL, and I tested this hypothesis. Surprisingly, it turns out to be the case, with results similar to the following for a number of cases.


In[1]:= Needs["DatabaseLink`"]

In[2]:= commodDB = OpenSQLConnection[JDBC["MySQL(Connector/J)", "localhost:3306/commoddb"],
Username -> "myUsername", Password -> "myPassword"];

In[3]:= Timing[
SQLSelect[commodDB, "tbcommodprices", {"date", "ticker", "price"},
SQLColumn["ticker"] == "LAV08 Comdty" && SQLColumn["whichprice"] == "last"];]

Out[3]= {0.031, Null}

In[4]:= Timing[
SQLExecute[commodDB, "SELECT date, ticker, price FROM `commoddb`.`tbcommodprices` where ticker='LAV09 Comdty' and whichprice='last'"];]

Out[4]= {0.047, Null}

(The two queries differ slightly because I did not want caching to give an advantage to the second query).

Posted in mathematica | Leave a comment

Mathematica has a new board on StackExchange

For many years, the MathGroup mailing list has been the best place to go with Mathematica questions. The new Mathematica board at StackExchange may give it a run for its money.

Posted in mathematica | Leave a comment

an old motto

Last year I noticed at auction a membership certificate for the Harvard Bicycle Club dated October 12th 1883. This was, I presume the predecessor of the current Harvard University Cycling Association, for which I raced when I was young and fit.

The Harvard Cycling Team was a big deal in the years between 1879 and about 1900, and their appearance at races in New York City were regularly covered by the New York Times.

The motto of the Harvard Bicycle Club appears on the red seal affixed to the certificate. It reads

“Mobilitate viget, viresque, acquirit eundo.”
Which is from the Aenid, and can be roughly translated as

“In freedom of movement lies her power, and she gathers strength with her going.”

Posted in wheels | Leave a comment

Sled Dogs are back again

I just got the following in e-mail.

——– Original Message ——–
Subject: Sled Dogs are back again!
Date: Mon, 24 Oct 2011 22:29:43 +0200
From: Extremesportok.hu <email hidden; JavaScript is required>
To:

Hi there,

I’m Gabor Stiglincz from extremsportok.hu. We’re doing improvements for the norwegian company about the SledDogs. I’m happy to let you know, that SledDogs snowskates will be available soon worldwide. This year in Europe mostly, but now we’re testing the new prototypes, and in 2012/2013 the production will grow! Check out the latest news at www.sleddogskates.com and at the Facebook page: http://www.facebook.com/pages/Sled-Dogs-Snowskates-Official/113229112116621
Stay tuned, and spread the news!

Sorry about my poor english… :)

All the best,

Gabor / www.extremesportok.hu

Posted in Uncategorized | Leave a comment

Mathematica at StackExchange

There is a proposal to create a Mathematica section at the popular programming Q&A site StackExchange. I think it’s probably a good idea; the mathgroup mailing list has been a great resource for years but the web is easier and quicker than e-mail sometimes.

Sign up to support it here:
Stack Exchange Q&A site proposal: Mathematica

(Or, if the link above is busted, just visit http://area51.stackexchange.com/proposals/15787/mathematica)

Posted in mathematica | Leave a comment