This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Follow the instructions below to set up the IBM DB2.



Preparing DB2 Database

Download the latest version of DB2 Express-C and install it on your computer.

Tip

Here you can find the instructions on how to install DB2 Express-C.


Setup Database and Users

Using DB2 Command Processor

1. Run DB2 console. Run db2start in command line to open the DB2

db2=> db2start

2. Create the database.

db2=> create database DB_NAME

3. Before you can issue an SQL statement, you have to connect to a database. Establish the connection:

db2=> connect to DB_NAME user USER_NAME using PASSWORD

4. Grant required permissions for users.

db2=> connect to DB_NAME
db2=> grant AUTHORITY on database to user USER_NAME

(AUTHORITY : SYSADM,SYSCTRL,SYSMAINT,SYSMON,DBADM or LOAD)

Please refer DB2 Express-C Guide for more details on DB2 commands.

Using DB2 Control Center

1. Open the DB2 control center using the command db2cc.

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 registry.xml file located in the $GREG_HOME/repository/conf directory of the deployed Governance Registry instance as below.

Note

You have to replace these settings with your custom values.

<currentDBConfig>db2-db</currentDBConfig>
    <dbConfig name="db2-db">
        <url>jdbc:db2://SERVER_NAME:PORT/DB_NAME</url>
        <userName>USER_NAME</userName>
        <password>PASSWORD</password>
        <driverName>com.ibm.db2.jcc.DB2Driver</driverName>
        <maxActive>50</maxActive>
        <maxWait>360000</maxWait>
        <minIdle>5</minIdle>
    </dbConfig>

The database configuration options

  • url - The URL of the database.
  • userName - The name of the database user.
  • password - The password of the database user.
  • driverName - 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.

2. Edit the user-mgt.xml file located in the $GREG_HOME/repository/conf directory of the deployed Governance Registry instance as below.

Note

You have to replace these settings with your custom values.

<Configuration>
        ...
        <Property name="url">jdbc:db2://SERVER_NAME:PORT/DB_NAME</Property>
        <Property name="userName">USER_NAME</Property>
        <Property name="password">PASSWORD</Property>
        <Property name="driverName">com.ibm.db2.jcc.DB2Driver</Property>
        <Property name="maxActive">50</Property>
        <Property name="maxWait">60000</Property>
        <Property name="minIdle">5</Property>
    </Configuration>

Tip

Default port for db2 instance is 50000.


Setup DB2 jdbc Drivers

Copy the DB2 jdbc Drivers ( db2jcc.jar and db2jcc_license_c0u.jar) from $DB2_HOME\SQLLIB\java to $GREG_HOME/repository/components/lib directory.

Tip

$DB2_HOME refers to the installation directory of DB2 Express C and $GREG_HOME refers to the directory where you run the WSO2 Governance Registry instance.


Create Database Tables

Database tables can be created either manually by running scripts or automatically by using start-up parameters.

Using Scripts

Database tables can be created manually by executing the following script in DB2 Express C command editor.

$GREG_HOME/dbscripts/db2.sql

Using start-up Parameters

Database tables can be created when starting WSO2 Governance Registry for the first time using the startup parameters as follows.

  • For Windows:
    $GREG_HOME/bin/wso2server.bat -Dsetup
    
  • For Linux:
    $GREG_HOME/bin/wso2server.sh -Dsetup
    

  • No labels