Category: Database

  • Install DB2 via the command line

    Links download screenI installed DB2 on an Ubuntu Linux server via SSH and the command line installer this morning. This is not particularly exotic, but is different from using the GUI installer on either platform. Still, I should jot down my steps:

    1. SSH to your server. On Windows, use Putty or the OpenSSL package in Cygwin.
    2. Open up a text mode browser like lynx or links
    3. Go to http://www.ibm.com/db2/express/
    4. Download Express-C. Get some tea and snacks while that happens.
    5. tar xzvvf the file and cd into the directory
    6. If the next step fails, you may need to install some libraries. I had to sudo apt-get install libstdc++5
    7. sudo ./db2setup
    8. You now need to manually configure the DB2 server
      1. Set up users and groups
      2. Create a DB2 Administration Server
      3. Create a DB2 instance
      4. Create links to DB2 files
      5. Configure TCP/IP communication
        1. Configure services file
        2. Update database manager
        3. Set communications protocols
      6. Apply license (already done, verifiable by db2licm -l)

    Extra notes just in case:

    • sudo is the usual way to escalate privileges on Ubuntu.
    • sudo su - db2inst1 is the way to switch users to, in this case, user db2inst1.
    • Default settings in the steps above make db2inst1 the user with SYSADM permissions for DB2.
    • For SFTP file transfer, you can use WinSCP or Filezilla with the same credentials as for SSH.
  • pureXML in DB2

    pureXML is the native XML storage capability in IBM DB2. It allows for whole XML documents to be stored in a DB2 table column, and for them to be easily queried via either SQL or XQuery or some combination of the two.DB2 pureXML book Getting Started with DB2 has a decent introduction to both . There’s also schema validation, versioning, and other esoteric features.

    I’ve played with it a fair bit and found it quite performant in my admittedly limited scenario of a couple thousand xml docs.

    Conor O’Mahony blogs extensively on the topic. In terms of community, there’s an official site, a comprehensive wiki, a forum.

  • Community

    Battle of Gaugamela

    October 1st is not just the anniversary of Alexander the Great’s triumph at Gaugamela. It’s not just the birthday of Jimmy Carter. It’s not just the National Day of the PRC.

    It’s also the online community action day. It is the day when we comment, we respond, we link, and we blog. It is the day when we go on a forum, like the DB2 Express forum, and answer just one question. It is the day when we pass on the urls of good sites, perhaps PlanetDB2 or ChannelDB2, to our friends and colleagues. It is the day when we find the blog posts that helped us solve an intractable question and say “Thanks! Gracias! Paldies! Spasibo!”

  • Back

    A month ago, Lisa and I returned from Germany. Along with Poland, Latvia, and Estonia, it was the site of our honeymoon. Germany was, of course, beautiful, but I was fascinated to see Latvia again. I hadn’t been back since I had left with my parents in 1995, and it has changed innumerably for the better.

    Lisa and Leo Berlin Haupstbahnhof Old Warsaw at Night Riga Meat Market

    But I digress. Not only have I learned to say “danke schön”, but so has the free DB2 book. Getting Started with DB2 Express-C is now available in Deutsch.

    Getting Started with IBM DB2

    I find that it is a good introduction to DB2 Express-C. The latter is the free database server in connection with which I am employed, but whose opinions I do not necessarily represent.

  • Firebug

    There’s now a version of Firebug that runs in IE, Safari, and Opera. It works as a bookmarklet or a javascript file. The profiling, debugging, and network sniffing features that make the full version of Firebug invaluable in Firefox aren’t there, but the DOM browsing feature alone makes the bookmarklet worth it.

    Firebug Lite

    Opera Dragonfly and Safari Web Inspector are the more full-featured, browser-specific alternatives.

  • Daily digest

    I am looking for an online tool that takes a feed and then republishes in digest format — one entry per day. Feed Informer just does a straight, entry-for-entry republishing. Ditto for Feedburner.

    This is for a Twitter feed, and Twitter Digest claims to do what I want, but it appears defective and unprofessional overall.

    Any ideas?

    Update: I found a Yahoo Pipes-based solution.

  • Repair table failed. Please run repair table.

    One of the tables of my MediaWiki installation crashed. When I tried to repair it, I got this less-than-helpful error message. So did the mysqlcheck utility when I SSHed to the server. However, the command has extra options that can be used to repair high levels of corruptions, such as when the MYI is missing.

    REPAIR TABLE tablename USE_FRM;
    
  • Jaxer

    John Resig writes very positively about Jaxer. It runs Javascript on the server while serving documents to the client, with seamless communication between JS on the client and JS on the server.

    Jaxer provides:

    1. Full DOM on the server
    2. Shared code between client and server
    3. Database, file, and socket access from JavaScript
    4. Familiar APIs
    5. Integration with PHP, Java, Rails, etc. apps

    In other news, IE8 will use the latest rendering mode by default for documents with the HTML5 doctype:

    
    

    Finally, Good Math has a published a good defense of Google’s MapReduce algorithm.

  • Dean

    Base2 has just come out in beta on Google Code. It’s hosted there and can be included straight off the Google Code server.

    I think it’s a really neat library because it basically fixes all browsers so that the built-in DOM, events, etc work the same way. Instead of providing an API of its own, it makes the existing API work consistently and reliably.

    Base2 Features:
    – A fast implementation of the Selectors API
    – Fixes broken browser implementations of the DOM events module including document.createEvent(), dispatchEvent(), addEventListener(), etc
    – Supports DOMContentLoaded
    – Fixes getAttribute()/hasAttribute()/setAttribute() (Internet Explorer)
    – Implements a few other useful DOM methods like getComputedStyle() and compareDocumentPosition()
    – Supports a variety of browsers including ancient browsers like IE5.0 (Windows and Mac)

    Dean Edwards has also done the excellent Packer Javascript minifier. It has probably the most in-depth support for obscure language features that simpler minifiers tend to mangle.

  • Rails and DB2 data types

    When creating a table in a Rails migration, you have to specify data types using platform-agnostic names. The mapping of Rails types onto DB2 types is defined in ibm_db_adapter.rb:

    :primary_key => @servertype.primary_key,
    :string      => { :name => "varchar", :limit => 255 },
    :text        => { :name => "clob" },
    :integer     => { :name => "integer" },
    :float       => { :name => "float" },
    :datetime    => { :name => "timestamp" },
    :timestamp   => { :name => "timestamp" },
    :time        => { :name => "time" },
    :date        => { :name => "date" },
    :binary      => { :name => "blob" },
    
    # A boolean can be represented  by a smallint,
    # adopting the convention that False is 0 and True is 1
    :boolean     => { :name => "smallint"},
    :xml         => { :name => "xml"},
    :decimal     => { :name => "decimal" }
    

    Useful Resources

    InfoCenter | DB2 Data Types
    dW | DB2 and Ruby on Rails, Part 1 (May 2007)
    dW | An Introduction to Ruby on Rails for DB2 Developers (June 2006)

    The DB2 adapter is now called ibm_db. You can refresh your installation by typing gem install ibm_db at the command line and choosing the latest win32 release.