DB2 - quality-manager/onboarding GitHub Wiki
Before you can even get started you need to configure OS X to support DB2. You will need to either edit or create the file /etc/sysctl.conf
(admin privliges needed) with these entries.
kern.sysv.shmmax=1073741824
kern.sysv.shmmin=1
kern.sysv.shmmni=4096
kern.sysv.shmseg=32
kern.sysv.shmall=1179648
kern.maxfilesperproc=65536
kern.maxfiles=65536
After making this change you need to restart your Mac for the changes to become active.
You will need XCode to run the DB2 installer. You can get XCode from the Mac OS X App Store.
- Open the App Store on your Mac
- Search for XCode
- Install XCode
*You can test that XCode is installed correctly by opening a terminal and typing otool
. If you get the "command not found" error then something is wrong.
You can get the DB2 installer for Mac OS X from IBM's public website. The IBM Db2 Express-C version is freely available and good enough for pretty much any development task.
- Download IBM Db2 Express-C here: https://www.ibm.com/analytics/us/en/db2/trials/
- Unzip the downloaded archive
- Open a terminal and navigate to the extracted directory (
cd ~/Downloads/expc
) - Execute the installer as administrator (
sudo ./db2_install
) - Accept the default install location
*You probably need to create an IBM ID for this
*The default install location for DB2 is /opt/IBM/db2/V10.1/
which is why you need admin privilages to run the installer. If you really want to deviate from this guide you could try running without admin privilages and changing the install location, but then you are on your own after that.
You probably need a second user that does not have administrator priviliges to own the DB2 instance that you are about to create. You can do this simply through OS X's Users and Groups wizard.
- Open Spotlight (
cmd + space
) - Search for "Users and Groups"
- Launch it (
Enter
) - Add a new user (
+
)
*We recommend using the name db2inst1
for your new user which seems to be the convention.
Before we can create the actual database that will hold the QM tables, we need to first create a DB2 instance.
- Navigate to the DB2 installation location (
cd /opt/IBM/db2/V10.1/
) - Execute the
db2icrt
script as admin noting the instance owner's name and the instance name (sudo ./db2icrt -u db2inst1 db2inst1
)
*The new instance is created in /Users/db2inst1/sqllib/
*The name of the owner and of the instance itself is often the same
We aren't totally clear on what this does, but everyone seems to agree that it is a required step. You'll want to execute these as the DB instance owner (e.g. db2inst1). Note that in order to do that you are going to have to give that user admin privileges, which seems counter intuitive. We recommend to just take away the admin privileges after running these commands.
- Give db2inst1 admin privileges (using OS X's Users and Groups wizard)
- Switch to your instance owner user (
su - db2inst1
) - Make root the owner of db2ckpw (
sudo chown root /Users/db2inst1/sqllib/security/db2ckpw
) sudo chmod u+rxs /Users/db2inst1/sqllib/security/db2ckpw
sudo chmod o+rx /Users/db2inst1/sqllib/security/db2ckpw
At this point you should be able to start the DB Manager, but due to some changes in OS X's security model since the release of this version of DB2, it won't work. To work around the problem you need to change the ownership of some scripts.
- Give your instance owner ownership of the files in the
adm
directory (sudo chown db2inst1 /Users/db2inst1/sqllib/adm/*
) - Run db2profile (
/Users/db2inst1/sqllib/db2profile
) - Run db2start (
/Users/db2inst1/sqllib/adm/db2start
)
*In general you need to run db2profile before running any db2 commands
Now that you have the DB Manager up and running you can finally create an empty database.
- Switch to instance owner (
su - db2inst1
) - Run db2profile (
/Users/db2inst1/sqllib/db2profile
) - Create the database (
/Users/db2inst1/sqllib/bin/db2 create database vtest on /Users/db2inst1 pagesize 16384
) - Set logsecond option to 64 (
/Users/db2inst1/sqllib/bin/db2 update db cfg for vtest using logsecond 64
)
*In this example we are setting the database name to vtest
*I have no idea why we set logsecond to 64, that's just what we do
At this point you have created a database but there is no way for QM to connect to that database. We need to configure it to be accessible via TCP/IP so that QM can reach it.
- Switch to instance owner (
su - db2inst1
) - Set the database's service name (
/Users/db2inst1/sqllib/bin/db2 update dbm cfg using svcename db2c_db2inst1
) - Add database's service name at port 50000/tcp in
/etc/services
file (db2c_db2inst1 50000/tcp
) - Set the DB Manager's DB2COMM property to TCPIP (
/Users/db2inst1/sqllib/adm/db2set DB2COMM=TCPIP
) - Stop the DB Manager (
/Users/db2inst1/sqllib/adm/db2stop force
) - Start the DB Manager (
/Users/db2inst1/sqllib/adm/db2start
)
*You'll need admin privileges to update /etc/services
*Make sure that there is a newline character after the last entry in /etc/services
*You can verify DB2COMM is set correct with /Users/db2inst1/sqllib/adm/db2set -all
Now you should finally be able to initialize the tables for QM's database. The standard QM Initialize 4.0 launcher is a good start, but we need to make some changes.
- Open the QM Initialize 4.0 launch config
- Change or add
com.ibm.team.repository.db.vender
toDB2
- Change or add
com.ibm.team.repository.db.jdbc.location
to//localhost:50000/vtest:user=db2inst1;password={password};
- Change or add
com.ibm.team.repository.db.jdbc.password
to yourdb2inst1
user's password - Disable any properties related to automatically creating project areas
*You might want to create a teamserver.properties files with these options configured there instead
*Note that you should actually write {password}
in the jdbc.location
property. Do not substitute your actual password here!
*If you try to automatically create project areas the DB Manager will be stopped halfway through initialization then initialization will fail because it can't connect to the DB. You'll need to manually create your project areas through the admin UI when using DB2.
*You'll need to make the same edits to your QM application launcher so that it connects to the right DB when it is launched
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014927797
http://www-01.ibm.com/support/docview.wss?uid=swg21396878
https://www.ibm.com/developerworks/community/forums/html/topic?id=b78fe48e-b92c-448f-9154-c5ff4728f77a