Fancy something in gold? Maybe with a Ruby? OK, I’ll stop being cryptic. IBM has announced the 1.0 release of the Ruby driver and Rails adapter for IBM databases (get it .. the “gold” release). That means DB2, Informix and Apache Derby/cloudscape. Great work team! This is a huge boost to the Ruby/Rails community, as IBM is one of the few vendors to release and support a vendor-provided driver/adapter. I have some examples of code from the book that shows off Rails and DB2 in action – so take a look at the free code examples on the book site.

For ages, IBM had engineered DB2 to include “extenders”, which were add-ons that provided useful para-database features, like free-text style searches that were awkward to express in traditional SQL.  News from Leons is that this technology has been moved into the core DB2 engine starting with v9.5.2. I’m still scrounging for information on the changes on the IBM site, but this is great news.

The DB2 book is done!

August 20, 2008

After about a year’s effort, the book I was writing hits the shelves today (well, yesterday, actually). Beginning DB2: From Novice to Professional is pretty much self-explanatory. It’s targetted at anyone who wants to learn DB2 on Linux, Unix and Windows. It’s a little unusual in that it covers both database admin stuff, as well as developer stuff … that just means you get more bang for your buck!

Here’s what the cover looks like.

Beginning DB2

Beginning DB2

More details at (when I get some content up there 🙂 ).

There I was coding away a chapter for the new book (Beginning DB2, released by Apress if you must know), when I realised Rails had some cool features, but this wasn’t one of them.

If I want to use Rails’ neat scaffolding feature to throw up a framework for a table

ruby script/generate scaffold thing

Then I have to define my ActiveRecord in a half-assed, stupidest-idea-ever plural form.

class ThingTable < ActiveRecord::Migration
def self.up
create_table :things do |t|
t.column :thingname, :string, :null => false
t.column :description, :string
t.column :value, :integer

def self.down
drop_table :things

You read that right, fellow starship troopers. Random pluralisation for fun and profit. Do you think the Rails designers were savvy enough to ensure correct pluralisation? How about Schema/Schemata … Octopus/Octopodes … Sheep/Sheep … or Gateau/Gateaux ? Oh, wait, I’m sure Rails would spell that last one “Ghetto”. 😛

IBM’s prolific Redbooks team have released the updated Oracle to DB2 conversion guide. While this is an excellent guide, it’s interesting to note that it still targets the previous version of DB2 for Linux, Unix and Windows … v8.1.

Oh well, maybe I can chip in an contribute to the re-write for version 9.1 🙂

What do government systems and databases have in common? The concept of the separation of powers. In a Westminster-style democracy, the three arms of power – the executive, the legislature, and the judiciary – each have separate well defined powers that are forbidden to the other arms of government. For example (and something the crowd at Microsoft should remember), the power to determine punishments is exclusively the right of the judiciary … not criminally convicted monopolists who engage in “self help” :-). But I digress.

The same idea holds in database land. Separate powers and privileges out into discrete realms, and grant those well-defined powers to appropriate users. Works well for DB2, Oracle, SQL Server … but crashes into the safety barrier of poor design when we get to MySQL.

MySQL gets it right in the more-recently added powers, such as creating and executing routines, but its flakey bedrock is shown in the way basic object creation privileges are managed. Creating and dropping tables and databases are controlled by the same two privileges. Read that again – the create privilege spans tables and databases, and the drop privilege is equally-poorly scoped. What it means in practice is that developers who should be given a restricted authority to create objects can now create entire databases, and worse, the power to drop a table comes bundled with the “oops, was that the dev or production database I just wiped” ease of use feature. These should be separate powers … so let’s see how many other people have requested this in the past on the MySQL forums/bug site, and if in the unlikely event that count is zero, I’ll submit it and we’ll see what happens. Stay tuned to watch the fun.