Follow the instructions below to set up the IBM DB2.
...
Table of Contents | ||||
---|---|---|---|---|
|
...
|
...
Preparing DB2 Database
Download the latest version of DB2 Express-C and install it on your computer.
...
1. Run DB2 console. Run db2start
in command line to open the DB2
Code Block |
---|
db2=> db2start
|
2. Create the database.
Code Block |
---|
db2=> create database DB_NAME
|
...
3. Before you can issue an SQL statement, you have to connect to a database. Establish the connection:
Code Block |
---|
db2=> connect to DB_NAME user USER_NAME using PASSWORD
|
...
4. Grant required permissions for users.
Code Block |
---|
db2=> connect to DB_NAME
db2=> grant AUTHORITY on database to user USER_NAME
(AUTHORITY : SYSADM,SYSCTRL,SYSMAINT,SYSMON,DBADM or LOAD)
|
...
Setup Configuration Files
1. Edit the registrydefault database configuration defined in the master-datasources.xml
file file located in the at $GREG_HOME/repository/conf
directory /datasources
directory of the deployed Governance Registry registry instance as below. Both the database configurations in registry.xml
and user-mgt.
xml
refer this data source.
Info | ||
---|---|---|
| ||
You have to replace these settings with your custom values. |
Code Block |
---|
<currentDBConfig>db2-db</currentDBConfig> <datasource> <name>WSO2_CARBON_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2CarbonDB</name> </jndiConfig> <dbConfig<definition nametype="db2-dbRDBMS"> <configuration> <url>jdbc:db2://SERVER_NAME:PORT/DB_NAME</url> <userName>USER_NAME</userName> <username>regadmin</username> <password>PASSWORD<<password>regadmin</password> <driverName>com <driverClassName>com.ibm.db2.jcc.DB2Driver</driverName>driverClassName> <maxActive>50<<maxActive>80</maxActive> <maxWait>360000</maxWait> <minIdle>5</minIdle> <testOnBorrow>true</testOnBorrow> <validationQuery>select 1 from sysibm.sysdummy1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </dbConfig> </definition> </datasource> |
The database configuration options
- url - The URL of the database.
- userName
username - The name of the database user.
- password - The password of the database user.
- driverName 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.
...
- .
Info | ||
---|---|---|
| ||
You have to replace these settings with your custom values. |
Code Block |
---|
<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>
|
Info | ||
---|---|---|
| ||
Default port for db2 instance is 50000. |
...
Database tables can be created manually by executing the following script in DB2 Express C command editor.
Code Block |
---|
$GREG_HOME/dbscripts/db2.sql
|
...
Database tables can be created when starting WSO2 Governance Registry for the first time using the startup parameters as follows.
For Windows:
Code Block $GREG_HOME/bin/wso2server.bat -Dsetup
For Linux:
Code Block $GREG_HOME/bin/wso2server.sh -Dsetup
...
Excerpt | ||
---|---|---|
| ||
Instructions on how to set up Governance Registry with IBM DB2. |