How to install SQL Server database for SonarQube

Last Updated on February 19, 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.
Learn more about SonarQube:
How to Install SonarQube on windows with tips for troubleshooting
SonarQube integration with Jenkins
To read other posts regarding SonarQube Click here
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 Authentication
Next we need to create a Sql Server user if we want to use Sql Server authentication. We can also use the currently logged in windows user for authenticating and working with Sql Server. We will discuss that as well later in this article.
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.

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 Database
Once, the login is created, right click the Databases folder and select New Database…

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.

Right click SonarDB database and click on Properties.

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

Connection String
Microsoft JDBC driver comes 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.
Windows Authentication
We can also use currently logged in windows user to create and connect to SonarQube database.
in this case we will skip the step to create a new login and directly move to Create New Database step to create a new database while being authenticated with the current windows login. We will select the <default> as the database Owner which will imply Windows user in this case. Then we will follow along the steps to select the correct collation. Next we will discuss the connection string for a windows authenticated user.
Connection String
Microsoft JDBC driver comes bundled with SonarQube. However, as per instructions provided in the sonar.properties file, we need to download the Microsoft Sql JDBC Auth package and copy jdbc authentication dll to any folder in the path of the SonarQube host. Check the correct version of the jdbc package required for your SonarQube installation from Sonar Docs or sonar.properties file.
In the sonar.properties file in the conf folder, look for JDBC url under Sql Server and uncomment the url after changing database name to SonarDB. We will use localhost as the server location for SQL Server as our server is installed locally.
Next we need to comment sql server user name and sql server password as we will be connecting to sql server via the logged in user.
In the connection string, we will append integrated security= true
We also need to consider here whether our Sql Server is enabled for encryption. The SQL Server I’m working with is currently not supporting encryption. Hence we will append encrypt=false to the jdbc url connection string. If your SQL Server requires encryption but you do not want SonarQube to validate the certificate, the we need to add the flag trustServerCertificate=true to the jdbc url connection string.
In our case the connection string becomes :
sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=SonarDB;integrated security =true; encrypt=false
Next 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 as well as with Windows 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.
