Download and install PostgreSQL in you computer, if it is not already done.
And Start the PostgreSQL service.
You can create database and the login role from a GUI using the
PGAdminIII tool.
To connect PGAdminIII to a PostgreSQL database server, locate the server from the object browser,
right client and click connect. This will show you the databases, tablespaces, login roles.
To create a database right click the 'Databases' entry in the tree (inside the object browser)
and click 'New database'.From the "New Database" dialog box give a name to the database
(say "gregdb") and click 'OK' button.
To create a login role, you need to right click the 'Login Roles' entry in the tree (insdie the
object browser) and click 'New Login Role'. Give a name for the role name and password.
These values will be used in the Governance Registry configurations as described in the
following sections. (In the configuration we are using 'gregadmin' as the role name and
'greadmin' as the password). You can provide the other policies like the expiration time for the login,
connection limit which are optional. Then click the 'OK' button to finish creating the
login role.
Setup Configuration Files
Edit the registry.xml file (inside the $GREG_HOME/repository/conf directory) of the deployed registry instance as below. (note the highlighted configurations, You
may use your own database name, username and password).
Explanation of the database configuration options.
url: The URL of the database
userName: The name of the database user
password: The password of the database user
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.
Edit the user-mgt.xml file (inside the $GREG_HOME/repository/conf directory) of the deployed instance as below. (note the highlighted configurations, You
may use your own database name, username and password).
Download the PostgreSQL jdbc4 driver from
http://jdbc.postgresql.org/download.html (Note that you have to download the JDBC4 driver) and
Place it in the $GREG_HOME/repository/components/lib directory (Here $GREG_HOME refers to the directory where you run the WSO2 Governance Registry instance).
Create Database
Automatic Database table Creation
Next at the first time you start the registry, run with the -Dsetup option, so
it will create all the tables in given PostgreSQL database.
wso2server.sh -Dsetup
wso2server.bat -Dsetup
You just configured WSO2 Governance Registry to run with PostgreSQL database.