{"id":7,"date":"2013-03-22T10:01:37","date_gmt":"2013-03-22T10:01:37","guid":{"rendered":"http:\/\/saurabhjain1537.wordpress.com\/?p=2"},"modified":"2025-02-27T07:46:43","modified_gmt":"2025-02-27T07:46:43","slug":"setup-sonar-with-postgresql-db","status":"publish","type":"post","link":"https:\/\/saurabhjain.dev\/?p=7","title":{"rendered":"Setup SONAR with PostgreSQL DB"},"content":{"rendered":"<p><strong>Objective:<\/strong> Setup a Sonar server pointing to a PostgreSQL DB server that can be used by multiple maven clients (developers) remotely<\/p>\n<p><strong>Software<\/strong>:<\/p>\n<ol>\n<li>Sonar 2.8<\/li>\n<li>PostgreSQL server 9.2<\/li>\n<li>Maven 3.3<\/li>\n<\/ol>\n<p><strong>Prerequisite<\/strong>: Maven and Sonar are already installed. Project repository contains sonar specific dependencies.<\/p>\n<p><strong>Procedure<\/strong>:<\/p>\n<p><span style=\"text-decoration:underline;\">Setup PostgreSQL DB server<\/span><\/p>\n<ol>\n<li>Install postgreSQL 9.2<\/li>\n<li>Use pgAdmin III to create a new Login Role\n<ol>\n<li>Username: sonar<\/li>\n<li>Password: sonar<\/li>\n<\/ol>\n<\/li>\n<li>Create a new Database \u2018sonar\u2019 having owner \u2018sonar\u2019 login role.<\/li>\n<\/ol>\n<p><span style=\"text-decoration:underline;\">Point SONAR to PostgreSQL DB<\/span><\/p>\n<ul>\n<li>Update &lt;sonar_home&gt;\\conf\\sonar.properties\n<ul>\n<li>Comment sonar.jdbc.* properties to deactivate the default embedded database (derby)<\/li>\n<li>Uncomment sonar.jdbc.* properties to use PostgreSQL<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<blockquote><p>sonar.jdbc.url:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 jdbc:postgresql:\/\/&lt;ip_address_of_postgresql_server&gt;\/sonar<br \/>\nsonar.jdbc.driverClassName:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 org.postgresql.Driver<br \/>\nsonar.jdbc.validationQuery:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 select 1<\/p><\/blockquote>\n<ul>\n<li>Copy postgresql-9.2-1002.jdbc3.jar to &lt;sonar_home&gt;\\extensions\\jdbc-driver\\postgresql<\/li>\n<li>Update &lt;maven_home&gt;\\conf\\settings.xml to add a profile for sonar<\/li>\n<\/ul>\n<blockquote><p>\u00a0 &lt;profile&gt;<br \/>\n&lt;id&gt;sonar&lt;\/id&gt;<br \/>\n&lt;activation&gt;<br \/>\n&lt;activeByDefault&gt;true&lt;\/activeByDefault&gt;<br \/>\n&lt;\/activation&gt;<br \/>\n&lt;properties&gt;<br \/>\n&lt;sonar.jdbc.url&gt;<br \/>\njdbc:postgresql:\/\/&lt;ip_address_of_postgresql_server&gt;\/sonar<br \/>\n&lt;\/sonar.jdbc.url&gt;<br \/>\n&lt;sonar.jdbc.driverClassName&gt;org.postgresql.Driver&lt;\/sonar.jdbc.driverClassName&gt;<br \/>\n&lt;sonar.jdbc.username&gt;sonar&lt;\/sonar.jdbc.username&gt;<br \/>\n&lt;sonar.jdbc.password&gt;sonar&lt;\/sonar.jdbc.password&gt;<br \/>\n&lt;sonar.host.url&gt;<br \/>\nhttp:\/\/&lt;ip_address_of_sonar_server&gt;:9000<br \/>\n&lt;\/sonar.host.url&gt;<br \/>\n&lt;\/properties&gt;<br \/>\n&lt;\/profile&gt;<\/p><\/blockquote>\n<ul>\n<li>Add IP address of machine where maven build is going to be executed to &lt;postgresql_home&gt;\\data\\pg_hba.conf<\/li>\n<\/ul>\n<blockquote><p>host\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;IP address of maven build machine&gt;\/32\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 trust<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Objective: Setup a Sonar server pointing to a PostgreSQL DB server that can be used by multiple maven clients (developers) remotely Software: Sonar 2.8 PostgreSQL server 9.2 Maven 3.3 Prerequisite: Maven and Sonar are already installed. Project repository contains sonar specific dependencies. Procedure: Setup PostgreSQL DB server Install postgreSQL 9.2 Use pgAdmin III to create &hellip; <a href=\"https:\/\/saurabhjain.dev\/?p=7\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Setup SONAR with PostgreSQL DB<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[48,56],"class_list":["post-7","post","type-post","status-publish","format-standard","hentry","category-technology","tag-postgresql","tag-sonar"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7"}],"version-history":[{"count":1,"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":790,"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=\/wp\/v2\/posts\/7\/revisions\/790"}],"wp:attachment":[{"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/saurabhjain.dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}