Installing SonarQube Server with SQL Server
This guide provides comprehensive instructions for installing and configuring SonarQube Server with Microsoft SQL Server as the database backend.
Prerequisites
Software Requirements
Microsoft SQL Server: Version 2016, 2017, 2019, 2022, or 2025
Express Edition is supported
Both Windows Authentication and SQL Server Authentication are supported
Java: Oracle JRE or OpenJDK version 21 (Java 17 is deprecated)
Operating System:
Linux (x64, AArch64)
Windows (x64)
macOS (x64, AArch64)
Hardware Requirements
Small-Scale Installation (up to 1M lines of code)
RAM: 4GB minimum
CPU: 2 cores (64-bit system)
Disk Space: 30GB minimum
Free Disk Space: Maintain at least 10% free
Large-Scale Installation (up to 50M lines of code)
RAM: 16GB minimum
CPU: 8 cores (64-bit system)
Disk Space: Varies based on codebase size
Free Disk Space: Maintain at least 10% free
Beyond 50M lines of code
Please reach out to our commercial support team for guidance.
For production installations, it is strongly recommended to host the database on a separate machine from the SonarQube Server host, with low latency between both hosts.
Database Installation and Configuration
Step 1: Install Microsoft SQL Server
Follow the installation wizard to complete the setup
Note the server name and instance name:
Default Instance: Uses port 1433
Named Instance (e.g., SQLEXPRESS): Uses dynamic ports or custom port
Enable TCP/IP Protocol (Required for SonarQube)
After installation, you must enable TCP/IP connections:
Open SQL Server Configuration Manager:
Press
Win + Rand type:SQLServerManager17.msc(for SQL Server 2025),SQLServerManager16.msc(for 2022)For other versions: 2022 = 16, 2019 = 15, 2017 = 14, 2016 = 13
Or search "SQL Server Configuration Manager" in Start Menu
Enable TCP/IP Protocol:
Expand SQL Server Network Configuration
Click Protocols for [INSTANCE_NAME] (e.g., "Protocols for SQLEXPRESS")
Right-click TCP/IP and select Enable
Configure Static Port 1433 (Optional but Recommended):
By default, SQL Server Express uses dynamic ports. Setting a static port simplifies configuration and eliminates the need for SQL Server Browser.
a. In SQL Server Configuration Manager, under Protocols for SQLEXPRESS:
Right-click TCP/IP and select Properties
Go to the IP Addresses tab
Scroll down to the IPAll section at the bottom
b. Configure the ports:
TCP Dynamic Ports: Clear this field (delete any value, leave it blank)
TCP Port: Enter
1433
c. Click OK
d. You will need to restart SQL Server for changes to take effect (see Step 6 below)
If you configure a static port 1433, you can use the simpler connection string:
Instead of using the instance name \\SQLEXPRESS.
Enable SQL Server Browser (Critical for named instances with dynamic ports):
If you configured static port 1433 in Step 3, SQL Server Browser is optional. However, it's still recommended for easier instance discovery.
SQL Server Browser is often disabled by default. You must enable it:
Method A: Using Services (Recommended)
Press
Win + R, typeservices.mscand press EnterScroll down and find SQL Server Browser
Right-click SQL Server Browser and select Properties
Change Startup type from Disabled to Automatic
Click Apply
Click the Start button
Click OK
Method B: Using SQL Server Configuration Manager
Go to SQL Server Services
Right-click SQL Server Browser and select Properties
Go to the Service tab
Set Start Mode to Automatic
Click OK, then right-click and select Start
Enable SQL Server Authentication (Mixed Mode):
SQL Server Express defaults to Windows Authentication only. You must enable Mixed Mode for SonarQube:
Open SQL Server Management Studio (SSMS)
Connect using Windows Authentication to
localhost\SQLEXPRESSRight-click the server name (at top of Object Explorer)
Select Properties
Go to Security page
Under "Server authentication", select SQL Server and Windows Authentication mode
Click OK
Restart SQL Server:
In SQL Server Services (or
services.msc), right-click SQL Server (SQLEXPRESS)Select Restart
Notes:
Without TCP/IP enabled, you'll see errors like "Connection refused" or "TCP/IP connection has failed"
Without Mixed Mode authentication, you'll see "Login failed for user 'sonarqube'"
Without SQL Server Browser running (if using dynamic ports), you'll see "SocketTimeoutException: Receive timed out"
Tip: Configuring static port 1433 (Step 3) eliminates the need for SQL Server Browser and simplifies troubleshooting
Step 2: Connect to SQL Server Using SSMS
Connecting with SQL Server Management Studio (SSMS) 2022 / 2025
Open SQL Server Management Studio (SSMS)
In the "Connect to Server" dialog, enter the following:
Server type: Database Engine
Server name:
localhost\SQLEXPRESS(for SQL Server Express 2022/2025)Alternative formats:
.\SQLEXPRESSor(local)\SQLEXPRESS
Authentication: Windows Authentication (default) or SQL Server Authentication
Configure Certificate Trust for SQL Server 2022 / 2025
SQL Server 2022 and 2025 enforce encryption by default but use a self-signed certificate. You'll need to trust this certificate:
Click Options >> at the bottom of the dialog
Go to the Connection Properties tab
Click View all SQLServer properties or look for Advanced button
Find and set Trust Server Certificate:
True(check the box)
Alternative method: In the Additional Connection Parameters field, add:
Click Connect
Troubleshooting Certificate Error: If you encounter this error when connecting:
Solution: Ensure you've set Trust Server Certificate to True in the connection properties as described in Step 3 above.
Step 3: Create the SonarQube Database
Once connected to your SQL Server instance, execute the following steps:
Create a New Database
Set Database Collation
CRITICAL: Collation MUST be case-sensitive (CS) and accent-sensitive (AS).
Enable READ_COMMITTED_SNAPSHOT
CRITICAL: READ_COMMITTED_SNAPSHOT MUST be enabled to prevent deadlocks under heavy loads.
Check if it's already enabled:
If the result is 0 (false), enable it:
Step 4: Create a SQL Server User for SonarQube
Prerequisites: Ensure you've enabled SQL Server Authentication (Mixed Mode) in Step 1: Install Microsoft SQL Server before proceeding.
Option A: Using SQL Server Authentication (Recommended for cross-platform)
Test the SQL Server Authentication
Before configuring SonarQube, test the login in SSMS:
Disconnect from SQL Server in SSMS
Reconnect with:
Server name:
localhost\SQLEXPRESSAuthentication: SQL Server Authentication
Login:
sonarqubePassword:
YourStrongPassword123!Trust Server Certificate: Check this box
If the connection succeeds, proceed to SonarQube configuration.
Option B: Using Windows Authentication (Windows only)
SonarQube Server Installation
Configuration
Step 1: Configure Database Connection
Edit the sonar.properties file located in <sonarqube_home>/conf/sonar.properties:
For SQL Server Express (Named Instance with Dynamic Port):
For SQL Server Express (Named Instance with Static Port 1433):
For SQL Server Default Instance:
For Windows Integrated Security:
SQL Server Express (Named Instance):
SQL Server Default Instance:
For Remote SQL Server:
Default Instance:
Named Instance:
Step 3: Configure Integrated Security (Windows Only)
If using Windows Authentication with Integrated Security:
Download the Microsoft SQL JDBC Auth package v12.10.2: https://github.com/microsoft/mssql-jdbc/releases/download/v12.10.2/mssql-jdbc_auth.zip
Extract
mssql-jdbc_auth-12.10.2.x64.dllfrom the downloaded ZIPCopy the DLL to a folder in your system's PATH environment variable, such as:
C:\Windows\System32Or add a custom folder to PATH
Grant SQL Server Permissions to the Service Account:
If running SonarQube as a Windows service, you must grant the service account permission to access the
sonarqubedatabase:a. Identify the Service Account:
Press
Win + R, typeservices.mscand press EnterFind the SonarQube service
Right-click → Properties → Log On tab
Note the account name (usually Local System account, which corresponds to
NT AUTHORITY\SYSTEM)
b. Grant Permissions in SQL Server: Open SSMS and execute the following SQL (replace
[NT AUTHORITY\SYSTEM]if your service uses a different account):
Starting SonarQube
Linux/macOS
Windows
Using Console Mode (for troubleshooting)
Post-Installation
Troubleshooting
Quick Fixes for Common SQL Server Express Errors
Error: Certificate Chain Not Trusted
Error Message:
Fix: Add trustServerCertificate=true to connection string:
Error: Connection Refused on Port 1433
Error Message:
Fix Option 1: Use named instance in connection string:
Fix Option 2 (Recommended): Configure SQL Server Express to use port 1433:
Open SQL Server Configuration Manager
Protocols for SQLEXPRESS → Right-click TCP/IP → Properties
Go to IP Addresses tab → Scroll to IPAll section
Clear TCP Dynamic Ports, set TCP Port to
1433Restart SQL Server service
Use connection string:
Error: Connection Timeout / SQL Server Browser Not Running
Error Message:
Fix Option 1: Enable and start SQL Server Browser service:
Press
Win + R, typeservices.mscand press EnterFind SQL Server Browser
Right-click → Properties → Change Startup type to Automatic
Click Apply → Click Start → Click OK
Restart SonarQube
Fix Option 2 (Recommended): Configure static port 1433 to avoid needing SQL Server Browser:
Open SQL Server Configuration Manager
Protocols for SQLEXPRESS → Right-click TCP/IP → Properties
Go to IP Addresses tab → Scroll to IPAll section
Clear TCP Dynamic Ports, set TCP Port to
1433Restart SQL Server service
Use connection string:
jdbc:sqlserver://localhost:1433;databaseName=sonarqube;trustServerCertificate=true
Error: Login Failed for User
Error Message:
Fix: Enable SQL Server Authentication (Mixed Mode):
Open SSMS with Windows Authentication (
localhost\SQLEXPRESS)Right-click server → Properties → Security
Select SQL Server and Windows Authentication mode
Click OK
Restart SQL Server service in
services.mscIn SSMS, run:
Error: Login Failed for Integrated Security (Windows Only)
Error Message:
Fix: Grant permissions to the account running SonarQube (usually Local System Account):
Identify the account: Usually
NT AUTHORITY\SYSTEM(Local System Account)In SSMS, run:
Ensure
integratedSecurity=trueis in the connection string and username/password are commented out.
Note: All five issues are common with SQL Server Express 2022 and 2025.
Recommended setup (simplest configuration):
Configure static port 1433 in SQL Server Configuration Manager (see Error 2/3 Fix Option 2)
Trust the certificate:
trustServerCertificate=trueEnable Mixed Mode authentication and create the SQL login
Use connection string:
jdbc:sqlserver://localhost:1433;databaseName=sonarqube;trustServerCertificate=true
Alternative setup (using named instance):
Use named instance:
localhost\\SQLEXPRESSTrust the certificate:
trustServerCertificate=trueEnable SQL Server Browser service
Enable Mixed Mode authentication and create the SQL login
Use connection string:
jdbc:sqlserver://localhost\\SQLEXPRESS;databaseName=sonarqube;trustServerCertificate=true
Common Issues
SonarQube Won't Start
Check the logs:
Common causes:
Java not installed or wrong version
Port 9000 already in use
Insufficient permissions
Database connection issues
Database Connection Errors
Error: "TCP/IP connection has failed" or "Connection refused"
This is the most common error, especially with SQL Server Express.
Error Messages You May See:
Or:
Solution 1: Use Named Instance in Connection String
If using SQL Server Express, specify the instance name:
Solution 2: Enable and Start SQL Server Browser
If you see error: "The connection to the host localhost, named instance sqlexpress failed" or "SocketTimeoutException: Receive timed out", the SQL Server Browser service is disabled:
Press
Win + R, typeservices.mscand press EnterFind SQL Server Browser
Right-click and select Properties
Change Startup type from Disabled to Automatic
Click Apply
Click the Start button
Click OK
Solution 3: Enable TCP/IP Protocol
Open SQL Server Configuration Manager
Press
Win + R, type:SQLServerManager17.msc(SQL Server 2025),SQLServerManager16.msc(SQL Server 2022)Or search "SQL Server Configuration Manager"
Expand SQL Server Network Configuration
Click Protocols for [INSTANCE_NAME]
Right-click TCP/IP and select Enable
Restart SQL Server service:
Go to SQL Server Services
Right-click SQL Server (SQLEXPRESS) and select Restart
Solution 4: Configure Static Port 1433 (Recommended Alternative)
Instead of using SQL Server Browser, configure SQL Server Express to use static port 1433:
Open SQL Server Configuration Manager
Go to SQL Server Network Configuration → Protocols for SQLEXPRESS
Right-click TCP/IP and select Properties
Go to IP Addresses tab
Scroll to bottom to IPAll section
Configure:
TCP Dynamic Ports: Clear this field (leave blank)
TCP Port: Enter
1433
Click OK
Restart SQL Server service:
Go to SQL Server Services
Right-click SQL Server (SQLEXPRESS) and select Restart
Then use this simpler connection string:
Benefits: No need for SQL Server Browser, simpler connection string, consistent port across environments.
Solution 5: Use Dynamic Port Connection (If Static Port Not Possible)
If you cannot set a static port, find and use the current dynamic port:
Open SQL Server Configuration Manager
Go to SQL Server Network Configuration → Protocols for SQLEXPRESS
Right-click TCP/IP and select Properties
Go to IP Addresses tab
Scroll to bottom to IPAll section
Note the port number in TCP Dynamic Ports (e.g.,
49172)
Then use this connection string:
Replace 49172 with your actual port number.
Solution 6: Check Firewall
Ensure SQL Server port is not blocked
For named instances with SQL Server Browser, allow UDP port 1434
For static port configuration, allow TCP port 1433
For dynamic ports, allow the specific TCP port shown in IPAll
Verify connection string:
Error: "Certificate chain was issued by an authority that is not trusted"
Error Message:
Solution: Add trustServerCertificate=true to your connection string:
This is required for SQL Server 2022 and 2025, which enforce encryption by default but use a self-signed certificate.
Error: "Login failed for user 'sonarqube'"
Error Message:
This error occurs when:
SQL Server Authentication (Mixed Mode) is not enabled
The
sonarqubelogin doesn't existThe password is incorrect
The user isn't mapped to the database
Solution - Step 1: Enable Mixed Mode Authentication
Open SSMS and connect using Windows Authentication:
Server name:
localhost\SQLEXPRESSAuthentication: Windows Authentication
Enable SQL Server and Windows Authentication mode:
Right-click the server name (at top of Object Explorer)
Select Properties
Go to Security page
Under "Server authentication", select SQL Server and Windows Authentication mode
Click OK
Restart SQL Server:
Press
Win + R, typeservices.mscand press EnterFind SQL Server (SQLEXPRESS)
Right-click and select Restart
Solution - Step 2: Create or Verify the SonarQube Login
Connect to SSMS (Windows Authentication) and run:
Solution - Step 3: Test the SQL Server Login
Before trying SonarQube again, test the login in SSMS:
Disconnect from the server
Reconnect with:
Server name:
localhost\SQLEXPRESSAuthentication: SQL Server Authentication
Login:
sonarqubePassword:
YourStrongPassword123!
If the connection succeeds, your SonarQube connection will work.
Solution - Step 4: Verify sonar.properties
Ensure the password matches exactly:
Error: "Cannot open database requested by the login" (Integrated Security)
Error Message:
This error occurs with integrated security when the Windows account running the SonarQube service does not have permissions in SQL Server.
Solution - Step 1: Identify the Windows Account
Press
Win + R, typeservices.mscand press Enter.Find the SonarQube service.
Right-click → Properties → Log On tab.
Note the account:
If it says Local System account, the user is
NT AUTHORITY\SYSTEM.If it says This account, it's a specific user (e.g.,
DOMAIN\username).
Solution - Step 2: Grant Permissions in SQL Server
Connect to SSMS (Windows Authentication) and run the following (replace [NT AUTHORITY\SYSTEM] with your account if different):
Solution - Step 3: Verify sonar.properties
Ensure integratedSecurity=true is used and credentials are removed:
Elasticsearch Won't Start
Common causes:
Insufficient disk space (needs at least 10% free)
Wrong file permissions
Insufficient RAM
Linux-specific prerequisites:
Performance Issues
Increase JVM heap sizes:
Use SSD storage:
Elasticsearch performance heavily depends on disk I/O
SSDs provide significantly better performance than spinning disks
READ_COMMITTED_SNAPSHOT Error
If you see deadlock errors, verify the snapshot isolation is enabled:
If it returns 0, enable it as shown in the Database Configuration section.
Database Connection Examples
SQL Server Express with Static Port 1433 (Recommended)
SQL Server Express (Named Instance with Dynamic Port)
SQL Server Default Instance
Remote Server with Custom Port
Encryption Enabled with Trusted Certificate
Using Environment Variables (Recommended for Production)
Instead of storing credentials in sonar.properties, use environment variables:
In PowerShell, use single backslash \SQLEXPRESS. In properties files, use double backslash \\SQLEXPRESS.
Security Best Practices
Database Security
Use strong passwords for SQL Server accounts
Limit database user permissions to only what's necessary
Enable SQL Server encryption (TLS/SSL)
Keep SQL Server patched and up to date
Use firewall rules to restrict database access
SonarQube Security
Change the default admin password immediately
Use strong authentication mechanisms (LDAP, SAML, etc.)
Enable HTTPS for the web interface (use a reverse proxy)
Review and configure global permissions
Regularly update SonarQube to the latest version
Configure regular database backups
Network Security
Use a reverse proxy (NGINX, Apache) in front of SonarQube
Enable HTTPS with valid SSL certificates
Restrict access to port 9000 to trusted networks only
Consider using a VPN for remote access
Backup and Maintenance
Database Backup
SonarQube Data Backup
Backup the following directories:
<sonarqube_home>/data/- Elasticsearch data<sonarqube_home>/extensions/- Installed plugins<sonarqube_home>/conf/sonar.properties- Configuration
Updating SonarQube
Backup the database and SonarQube directories
Download the new version
Stop the current SonarQube instance
Replace the binaries (keep
data,extensions, andconffolders)Start SonarQube - it will automatically upgrade the database schema
Check logs for any errors
References
Related pages:
Microsoft SQL Server
Community Support
License
SonarQube is available as:
SonarQube Community Build: Open source (LGPL v3)
SonarQube Server Developer Edition: Commercial license
SonarQube Server Enterprise Edition: Commercial license
SonarQube Server Data Center Edition: Commercial license
See Plans and Pricing for more information.
Last updated
Was this helpful?

