DB2 on Ubuntu

Have you heard about Ubuntu ?  Its one of the most popular open source linux distribution available. Lot of people associate  open source with unstable and unreliable software, but ironically its not.  Majority of the open source software are pretty good and come with good user group support.  One such distribution is Ubuntu.

ubuntulogo

Ubuntu does have an option for commercial support from Canonical.  Today Ubuntu comes with three different flavors…yeah just three unlike certain other operating systems that comes with half a dozen editions.

I have been using the desktop edition for a while and its been very stable.  I used to have the server edition which hosted my personal mail server, but one fine morning the motherboard decided to fry a chipset. They also have a laptop/netbook edition, I am told its pretty good as well although I haven’t tried.   Ubuntu just released 9.04.   The latest version is pretty sweet and boots fast.  If you are running Ubuntu 8.10, then there is a straight upgrade path, otherwise you have install  Ubuntu 9.04 .  

Download db2 express c

One of the operating systems IBM DB2 V9.5 supports is Ubuntu 32 bit and 64 bit.  Here is how to install DB2 on Ubuntu.  Once you download Ubuntu and DB2 

Install Ubuntu and make sure you update all the patches.

Unzip and untar the DB2 install file

Ensure you satisfies all the prerequisites for DB2

Run db2setup and follow the instructions on GUI screen. The install options are pretty easy and if you are new to DB2, you can choose the typical install option. If its the first time I recommend selecting the create instance option.

sudo ./db2setup

While running db2setup, if you encounter the following error message :
ERROR:
 The required library file libstdc++.so.5 is not found on the system.
ERROR:
 The required library file libaio.so.1 is not found on the system.
 Check the following web site for the up-to-date system requirements
 of IBM DB2 9.5
 http://www.ibm.com/software/data/db2/udb/sysreqs.html
 http://www.software.ibm.com/data/db2/linux/validate
/home/rpillai/Desktop/exp/db2/linux/install/../bin/db2usrinf:
error while loading shared libraries: libstdc++.so.5:
cannot open shared object file: No such file or directory
[: 609: 0: unexpected operator
/home/rpillai/Desktop/exp/db2/linux/install/../bin/db2langdir:
error while loading shared libraries: libstdc++.so.5:
cannot open shared object file: No such file or directory
/home/rpillai/Desktop/exp/db2/linux/install/../bin/db2langdir:
error while loading shared libraries: libstdc++.so.5:
cannot open shared object file: No such file or directory
DBI1055E The message file db2install.cat cannot be found.
Explanation:  The message file required by this
script is missing from the system; it may have been
deleted or the database products may have been loaded
incorrectly.
User Response:  Verify that the product option containing
the message file is installed correctly.  If there are
verification errors; reinstall the product option.

You can solve the above issue by  running the following command
sudo apt-get install libstdc++5
sudo apt-get install libaio-dev
sudo ./db2setup

Once you install finishes, sudo to instance and check whether you can connect to sample database. You can list the available databases by typing

db2 list db directory                         <<  list databases

db2 connect to sample                    << connect to the sample database 

db2 list tables for all schema        << list all tables in the database

You can stop and start db2 with the following commands :

db2start                                                <<  starts db2

db2stop                                                 << stops db2

About rpillai

I am a technology enthusiasts and love to work with databases and other technology. Learning new things everyday and don’t think the path ever ends …

This entry was posted in Applications, db2, linux and tagged , , , , , , , , , , , . Bookmark the permalink.