Setup SONAR with PostgreSQL DB

Objective: Setup a Sonar server pointing to a PostgreSQL DB server that can be used by multiple maven clients (developers) remotely


  1. Sonar 2.8
  2. PostgreSQL server 9.2
  3. Maven 3.3

Prerequisite: Maven and Sonar are already installed. Project repository contains sonar specific dependencies.


Setup PostgreSQL DB server

  1. Install postgreSQL 9.2
  2. Use pgAdmin III to create a new Login Role
    1. Username: sonar
    2. Password: sonar
  3. Create a new Database ‘sonar’ having owner ‘sonar’ login role.

Point SONAR to PostgreSQL DB

  • Update <sonar_home>\conf\
    • Comment sonar.jdbc.* properties to deactivate the default embedded database (derby)
    • Uncomment sonar.jdbc.* properties to use PostgreSQL

sonar.jdbc.url:                            jdbc:postgresql://<ip_address_of_postgresql_server>/sonar
sonar.jdbc.driverClassName:                org.postgresql.Driver
sonar.jdbc.validationQuery:                select 1

  • Copy postgresql-9.2-1002.jdbc3.jar to <sonar_home>\extensions\jdbc-driver\postgresql
  • Update <maven_home>\conf\settings.xml to add a profile for sonar


  • Add IP address of machine where maven build is going to be executed to <postgresql_home>\data\pg_hba.conf

host       all          all          <IP address of maven build machine>/32         trust


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s