json

Installing DB2 in Linux

In Database, Fedora, Linux on August 17, 2012 at 9:18 am

here’s the lowdown on setting up a db2 database in your linux box:

1) Download db2 Express from

http://www-01.ibm.com/software/data/db2/express/download.html

2) As root, extract the installer:

tar cvf db2_v101_linuxia32_expc.tar.gz

this should create a directory called “expc“.

3) do a ‘cd expc‘ and run the installer “./db2setup“. This will run the installer and ask you to create 3 different types of users, the admin, user and a fenced user.. take note of the names (you can use the defaults) and passwords.  Note that DB2 will create these users in your linux system.

4) After creating the users start the db2 server by  logging in as the db2 administrator (use the administrator username as defined in db2) or do an ‘su db2admin’ assuming db2admin is the admin user.

5) type ‘db2admin start‘.  This should start the db2 instance.

6) To add a new database, log in as the db2 user (you can also do an ‘su db2user1’, assuming db2user1 is the user username just make sure you do a ‘cd ~db2user1’ after as db2 requires the current user to be on a writeable directory).

7) Once you’ve logged on as the db2 user you can now begin creating your database. To create login to the db2 server:

db2 <enter>

this should give you the “db2 =>” prompt.

8) First create the database:

db2=> start database manager
db2=> create database test

db2 => activate database test
db2 => connect to test
db2 => create table employee ( Empno smallint, Name varchar(30),hiredate date)
db2 => select * from employee
db2 => quit

hope this helps.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: