Prepare the environment
IBM has provide the VM image with DB2 9.7 Express-C preinstall on the Linux along with other training material. You can download them from here http://www14.software.ibm.com/webapp/download/search.jsp?pn=DB2+Express-C
You will need to create the IBM account to download it. The account registration is free. The DB2 Academic Training Materials has good instruction how to setup the VM.
You will also need the VM Player to run the image. I use VMware workstation long time ago ( about 5 years ) while the time VMware just announce the VM player product. As I recall, VM Player is the read-only VM solution which means it can not be used to create the virtual machine like VMware work station. I was quite surprise this time when I use the VM Player, I seem to be able to create the VM. While starting up the VM, it will ask you whether to install or upgrade the VMware tools on the guest OS. This will help out the performance of the VM.
The Default user name is root. Password is password. You can find all those information in the VMware Basics and Introduction_Lab guide, which is also include in the training material. After accept the license agreement, you will see the actual login screen
The user name is db2inst1 and password is password .
Connect to the db2
List the basic db2 environment variables. Including the instance name.
Find the instance name from DB2INSTDEF
Attach to the instance. This step similar to the MSSQL/Sybase connect to the database instance but not yet to use the database.
db2 attach to <INSTNACE NAME>
Find the DB2 database name from catalog.
db2 list database directory
Connect to the database.
DB2 connect to <database name>
Run query from db2 command . DB2 table name is case sensitive.
DB2 "SQL Statement"
Other useful basic db2 command
Check memory/uptime from the snapshot
db2 get snapshot for dbm
check the instance configure
DB2 get dbm cfg
db2 get dbm cfg show detail
check the database configure
db2 get db cfg
db2 get db cfg show detail