Ruby on DB2 - a Linux Nightmare With a Happy End!

Although the title might look dramatic, it’s pretty close to what I’ve been through.

I have set up a Ubuntu 64 bits on my laptop last week to do some tests with Ruby and DB2. Oh man, it is not complicated, is it? It shouldn’t be, actually.

Too sad that I found this so late! It’s a post from a friend, Antonio Cangiano, describing the most common problems you may find trying to set up this environment (Linux + Ruby + DB2). You will probably get it working the first time, if you read it word by word. But if not, here are some extra tips that I can share with you.

- If you installed Ruby using your distribution’s package manager, remove all ruby packages completely. After that, install ruby exactly as described in Antonio’s post, typing this in the console:

$ sudo apt-get install build-essential
$ sudo apt-get install ruby-full rubygems

After that, you may try again.

- Another problem I found was after getting the driver built. I have written a simple program to try the connection and got this message:

Failed to load IBM_DB Ruby Driver

The thing is that this error really means it was not able to find the file libdb2.so.1 in the /usr/lib directory. Issuing this command may settle things for you - it will create the missing symbolic link:
$ ln -s /opt/ibm/db2/V9.5/lib64/libdb2.so.1 /usr/lib

Good luck!

Comments