Follow the instructions below to set up the IBM DB2.
Preparing DB2 Database
Download the latest version of DB2 Express-C (http://www-01.ibm.com/software/data/db2/express/download.html) and install it on your computer.
For instructions on installing DB2 Express-C, refer to
Setup Database and Users
Using DB2 Command Processor
1. Run DB2 console. Run
db2start in command line to open the DB2
2. Create the database.
3. Before you can issue an SQL statement, you have to connect to a database. Establish the connection:
4. Grant required permissions for users.
For more information on DB2 commands, refer to DB2 Express-C Guide at: http://www.ibm.com/developerworks/wikis/display/db2/free+book-+getting+started+with+db2+express-c.
Using DB2 Control Center
1. Open the DB2 control center using the command
db2cc. For example,
2. Create a new database. Right click the "All Databases" entry in the Control center tree (inside the object browser) and click "Create Database"-->"Standard". Follow the steps in the "Create new Database" wizard.
3. Create the new database users from "User and Group Objects" entry for your newly created database.
4. Give required permissions to newly created users.
Setup Configuration Files
1. Edit the default database configuration defined in the
master-datasources.xml file located at
$CARBON_HOME/repository/conf/datasources directory as below. Both the database configurations in
user-mgt.xml refer this data source.
You have to replace these settings with your custom values.
The database configuration options
- url - The URL of the database.
username - The name of the database user.
- password - The password of the database user.
- driverClassName - The class name of the database driver.
- maxActive - The maximum number of active connections that can be allocated from this pool at the same time or negative for no limit.
- maxWait - The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or <= 0 to wait indefinitely.
- minIdle - The minimum number of active connections that can remain idle in the pool without extra ones being created or 0 to create none.
Default port for db2 instance is 50000.
Setup DB2 jdbc Drivers
Copy the DB2 jdbc Drivers (
$DB2_HOME refers to the installation directory of DB2 Express C and
$CARBON_HOME refers to the directory where you run the WSO2 Carbon instance.
Create Database Tables
Database tables can be created either manually by running scripts or automatically by using start-up parameters.
Database tables can be created manually by executing the following script in DB2 Express C command editor.
Using start-up Parameters
Database tables can be created when starting WSO2 SS for the first time using the startup parameters as follows.