Using MySQL with JRuby

For some reason, I had a relatively hard time finding this info all in one spot, so here it is: Using MySQL with JRuby is actually pretty easy (and no annoying arch issues on OS X! :-) Install GEMs (DBI, JDBC driver, DBI adapter): $ jgem install dbi jdbc-mysql dbd-jdbc Then use it! require 'dbi' require 'jdbc/mysql' dbh = DBI.connect('dbi:jdbc:mysql://localhost:3306/test', 'root', '', { "driver" => "com.mysql.jdbc.Driver" } )

February 24, 2010 · 1 min · chetan

Writing command line interfaces for Spring apps

I recently needed to script some tasks for a Spring-based app at work so we could shove it into a crontab. It proved to be much easier than I thought. You can use your spring.xml config file for wiring up your beans as usual, but rather than deal with various property files you can easily override properties on the fly using system properties. See the following example: In your spring.xml make sure you have this line: ...

June 30, 2009 · 1 min · chetan