How to configure Sonarqube on a different database server using RedHat servers?

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

I am using sonarqube version - community-release-el7-3.noarch.rpm

i am trying to configure Sonarqube on REDHat Linux server to use a MSSQL database on a different server,

I opened the /opt/sonarqube/conf/sonar.properties and since I am using mssql server, i changed the sonar.jdbc.url with value sonar.jdbc.url=jdbc:sqlserver://ip address of databse server;databaseName=sonar

Now my Questions:

  1. is the above correct?
  2. is it compulsory for the sonarqube server and database server to be on the same network?
  3. is there other configuration i have to do to connect to the database on different server?

Hi,

Welcome to the community!

You appear to be using SonarQube 7.3, which is past EOL. You should upgrade immediately. Your upgrade path is:

7.3 → 7.9.6 → 8.9.1 → 9.0 (last step optional).

Regarding your question, the server and database to not need to be on the same server. In fact, it’s recommended that they not be. Regarding your DB URL, you can follow the format of the example URL in the config file. It should be a good start. You’ll likely also need to uncomment and set the DB credentials properties in sonar.properties.

 
HTH,
Ann

is it compulsory for the sonarqube server and database server to be on the same network?

Hi,

It’s not compulsory, but the closer they are to each other on the network the better for performance.

 
Ann

Thanks for your help

The configuration for my server in /opt/sonarqube/conf/sonar.properties is
sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar

since the sonarqube engine is in a different server to the database, is it not supposed to be something like:
sonar.jdbc.url=jdbc:sqlserver://192.168.112.41;databaseName=sonar

I am just curious how sonarqube on a different server can connect to database on another server if the configuration is still “localhost”

Hi,

That localhost JDBC URL is only going to work if SonarQube and your DB are on the same server (which is not a recommended setup!). You should update the URL to properly point to the box hosting the DB.

 
Ann