How to configure WSO2 Carbon platform to work with PostgreSQL database?

WSO2 Carbon platform(v3.0.0-SNAPSHOT above) now supports PostgreSQL databases. Here's how you configure WSO2 Carbon platform for PostgreSQL.

Step 1: Database configuration for registry

Modify database configuration in $CARBON_HOME/repository/conf/registry.xml as follows.
   <dbConfig name="wso2registry">
        <url>jdbc:postgresql://localhost/[DATABASE-NAME]</url>
<userName>[DATABASE_USERNAME]</userName>
<password>[DATABASE_PASSWORD]</password>
<driverName>org.postgresql.Driver</driverName> <maxActive>40</maxActive> <maxWait>60000</maxWait> <minIdle>5</minIdle> </dbConfig>

Step 2: Database configuration for user manager

Modify database configuration in $CARBON_HOME/repository/conf/user-mgt.xml as follows.
 <Configuration>
    <AdminRole>admin</AdminRole>
    <AdminUser>
      <UserName>admin</UserName>
      <Password>admin</Password>
    </AdminUser>

    <EveryOneRoleName>everyone</EveryOneRoleName> <!-- By default users in thsi role sees the registry root -->
    <ReadOnly>false</ReadOnly>
    <MaxUserNameListLength>500</MaxUserNameListLength>

    <Property name="url">jdbc:postgresql://localhost/[DATABASE_NAME]</Property>
<Property name="userName">[DATABASE_USERNAME]</Property>
<Property name="password">[DATABASE_PASSWORD]</Property>
<Property name="driverName">org.postgresql.Driver</Property> <Property name="maxActive">40</Property> <Property name="maxWait">60000</Property> <Property name="minIdle">5</Property> </Configuration>

Step 3: JDBC Driver for PostgreSQL

Place JDBC driver for PostgreSQL inside $CARBON_HOME/repository/components/lib directory. (Tests were carried out using PostgreSQL 8.3.8 as database server & postgresql-8.4-701.jdbc3.jar as the JDBC driver)

Step 4: Starting up server for the first time

Go inside $CARBON_HOME/bin & execute ./wso2server.sh (.bat) with -Dsetup option. 
./wso2server.sh -Dsetup
This will create required database tables using PostgreSQL script (postgresql.sql) located inside $CARBON_HOME/dbscripts.
(**important: For subsequent re-starts do not use -Dsetup option as this will re-create the database)

 

fordendk's picture

Any updates on this?

Many people will be wanting to move away from MySQL after the Oracle acquisition of Sun so it is therefor worthwhile to have a decent alternative like Postgresql for them.
f.lovotrico.tdnet.it's picture

Can't find postgresql.sql

Hi, I can't find any postgresql.sql script in the carbon distribution, where can I find it? Thanks
l.trotti.tdnet.it's picture

Can't find postgresql.sql

Same problem here. I've tried to convert mysql.sql into something that is postgresql readable but I'm having problems with the null value of "um_id" I found on mysql.sql since "um_id" seems to have to be a primary key for the tables where it's present. Any help would be appreciated.
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)