How to install SQL Server database for SonarQube

Last Updated on January 27, 2026

Overview

SonarQube is a tool used for code quality management. It stores the information regarding code quality in a database.

SonarQube comes with an inbuilt database that is meant for evaluation purpose. Once one starts using SonarQube for production, it is recommended to switch to one of the databases supported by SonarQube.

Here we will discuss how to setup SQL server database for SonarQube. To write our sample code, we will use SQL Server Express.

Install SQL Server

Let us start with downloading and installing the SQL Server Express database from Microsoft website. We will be using Sql Server Express Edition 2022 in this post.

Once we are done installing the database, we will also need Microsoft SQL Server Management Studio. 

We will download it from Microsoft website and install. This is the download link for MSSMS at the time of writing this post.

Configurations

Once the installations are complete, we will open SQL Server Configuration Manager.

Then go to SQL Server Network Configuration -> Protocols for SQLEXPRESS

Select TCP IP. Mark Enabled=Yes

Then set the TCP port by going to IP Addresses tab -> IPALL -> TCP Port = 1433

SQL Server Configuration Manager

Create New Login

For creating a new login, we will go to Start Menu and open Microsoft SQL Server Management Studio.

Select the Server Name. Select default windows authentication.

Open the Object Explorer.

Next open Security folder in the Object Explorer

Right click on Logins. Select New Login… from the right menu.

Open New Login Screen

On the new login screen create a new user with a Login Name and a password. We will create a user with Login Name as sonar with SQL Server authentication as shown above. 

Create New Login: sonar

Create New Database

Once, the login is created, right click the Databases folder and select New Database… 

Microsoft SQL Server Management Studio

In the new screen provide Database Name. We will name it as SonarDB. You can provide any name of your choice. For Owner, we need to change the <default> by selecting the newly created login as the Owner.

The new database name will be shown under Databases in the Object Explorer.

New Database SonarDB is created

Right click SonarDB database and click on Properties.

Open Database Properties

Select the correct collation. It should be case sensitive (cs) and accent sensitive (as) as shown below. 

Select Case Sensitive and Accent Sensitive Collation

Connection String

Microsoft JDBC driver cones bundled with SonarQube. In the sonar.properties file in the conf folder, uncomment the section with JDBC user and password.

sonar.jdbc.username

sonar.jdbc.password

We will update the user as sonar and provide a password. 

Now under SQL Server, look for JDBC url. Uncomment the url after changing database name to SonarDB. We will also use localhost as the server location for SQL Server as our server is installed locally. In our case this becomes :

sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=SonarDB

Start the SQL Server service. Also start/restart the SonarQube service and open SonarQube in browser. SonarQube should now start use SQL Server database.

Conclusion

In this post, we have downloaded, installed, configured SQL Server to create a database with SQL server authentication. Then we updated sonar.properties file to configure SonarQube to use the SQL Server database we have created.

Let us know if you found this post helpful.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *