Talk = Ruby + An Introduction to Using MySQL with Ruby

Ruby and MySQL
Location: Ballroom A Level: Novice
Average rating: ****.
(4.00, 1 rating)

This talk will cover the basics of using MySQL with Ruby, providing an overview of the three most popular and pragmatic options for using MySQL with Ruby: the mysql gem, DBI/DataObjects, and ActiveRecord. The talk will center around a small database driven Ruby application, which will be refactored to use each successive layer of abstraction.

The first portion will concentrate on the lowest level of abstraction: the MySQL gem. This library provides very rudimentary but flexible access to a MySQL database. This portion will also introduce the application which will be used throughout the talk: a simple command line ticketing system. The system will allow users to enter, resolve, and delete tickets using a MySQL backend.

After the introductory material and first section, we’ll discuss two “uniform interface” options: DBI and DataObjects. The emphasis will be on DataObjects, since, although it is a newer project, it is better actively developer and database agnostic (i.e., it supports the same API for every database vendor). We will refactor the application to use DataObjects and then demonstrate it working with MySQL and other database vendors.

The final portion will look at a few ORM options for Ruby, primarily concentrating on ActiveRecord. Others such as Og and DataMapper will be mentioned, but ActiveRecord’s popularity, stability, and vibrant user community make it an obvious choice for object-relational mapping with Ruby. The application will finally be refactored to use ActiveRecord, emphasizing the compactness and readability of the code afterwards.

The only assumptions for this talk are that the attendee knows what MySQL is and knows the basics of Ruby (or any other programming language).

Photo of Jeremy McAnally

Jeremy McAnally


Jeremy has been developing applications with Ruby and Rails for a little over five years, but before that he tortured himself with PHP, C#, Python, VB, and other instruments of destruction. After finding the light, he worked with Ruby for a while and penned Mr. Neighborly’s Humble Little Ruby Book (soon to be published by No Starch). Since then he has continued writing software, books (such as Ruby in Practice for Manning), open-source code (such as dcov, context, and more), presentations for numerous Ruby conferences and user groups, blogs at, and basically done anything he can to sharpen his Ruby (and Rails)-Fu. He likes good food, good times, and a mean game of Wii Sports Resort Tennis.

  • Kickfire
  • Zmanda, Inc.
  • Continuent
  • EDS
  • JasperSoft
  • Sun Microsystems
  • Symantec Anti-Virus Software
  • XAware
  • Data Direct Technologies
  • Dolphin Interconnect Solutions
  • Hewlett Packard
  • Infobright, Inc
  • Linagora
  • Microsoft
  • OpSource
  • Oracle
  • Pentaho
  • R1Soft
  • Red Hat
  • Ticketmaster
  • TechRepublic

Contact Us

View a complete list of MySQL contacts.