SonarQube with Postgres

database
postgres
(Tweety Darling) #1

I tried to configure sonarqube (7.6) to use postgresql database and it seems to ignore the jdbc entries in the sonar.properties and picks up the H2 database. When I pass the properties as jvm parameters, it picks up fine. How do I configure sonar to use postgres from the sonar.properties

sonar.properties:

sonar.jdbc.username=myuser
sonar.jdbc.password=mypwd
sonar.jdbc.url=jdbc:postgresql://ipaddress:5444/mypostgres
sonar.log.level=DEBUG

Log snippet:

2019.03.25 05:42:03 INFO web[o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2019.03.25 05:42:03 INFO web[o.s.s.p.LogServerVersion] SonarQube Server / 7.6.0.21501 / d56689a5eb122c06cf87375828085609f5a68323
2019.03.25 05:42:03 INFO web[o.s.s.p.d.EmbeddedDatabase] Starting embedded database on port 9092 with url jdbc:h2:tcp://127.0.0.1:9092/sonar
2019.03.25 05:42:03 INFO web[o.s.s.p.d.EmbeddedDatabase] Embedded database started. Data stored in: /opt/sonarqube/data
2019.03.25 05:42:03 INFO web[o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://127.0.0.1:9092/sonar
2019.03.25 05:42:03 WARN web[o.s.db.dialect.H2] H2 database should be used for evaluation purpose only.
2019.03.25 05:42:05 INFO web[o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube

(Julien Lancelot) #2

Hi,

Are you sure you don’t have another sonar.jdbc.url entry ?
Could you search for the text ‘h2’ in the file ?

Regards,
Julien Lancelot

(Tweety Darling) #3

The sonar.properties has only 4 lines as pasted above. I removed all the entries from the default sonar.properties and kept only the jdbc and log properties there.

(Julien Lancelot) #4

Are you using a Docker image ? Are you sure the sonar.properties is in a folder that can be read by SonarQube ?

(Tweety Darling) #5

Yes. I’m using a docker image. The sonar.properties are located in conf/sonar.properties and the properties file seems to be used by sonarQube. The ‘sonar.log.level=DEBUG’ seems to come into effect and starts logging ‘debug’ level events.

(Julien Lancelot) #6

Then I’m sorry but I’ve not idea what is not working…

(Tweety Darling) #7

no worries. I went with the JVM parameters approach and it works fine. Thank you for your help!