Posted by Anuraj on Thursday, May 28, 2015 Reading time :1 minute
By default SonarQube comes with an embedded database, which is not recommended for production use and which cannot be scaled.
This post is about configuring SonaqQube to use SQL Server instead of default database.
As the first step you need to configure SQL Server. Using SQL Server configuration manager, make sure, TCP/IP protocol enabled for SQL Server instance you want to use. In this post I am using SQLExpress.
Once enabled, double click on the TCP/IP protocol, or select properties of TCP/IP protocol. And set port number to 1433, default TCP/IP port for SQL server.
Once it is done, you need to restart the SQL Server. Now create a database with name “SONAR” using SQL Server management studio.
Next you need to download the SQL Server JDBC driver, you can download it from here. Once downloaded, extract the zip file, and copy “jtds-1.3.1.jar” file to “sonarqube-5.1\extensions\jdbc-driver\mssql” directory(default, MSSQL folder won’t be there, you need to create it manually). Now modify the “sonar.properties” file under “sonarqube-5.1\conf” directory. Un comment sonar.jdbc.username and sonar.jdbc.password properties if you are using SQL Authentication. And modify “sonar.jdbc.url” property and provide the connection string there.
And if you are using Windows authentication to connect to SQL Server, you need to use connection string like this.
Now double click on the StartSonar.bat, which will start the sonar server. If everything is fine, it will start the sonar server and you can browse it using http://localhost:9000.
If something went wrong you can get information about the issues in the “sonar.log” file inside “sonarqube-5.1\logs” folder. Since you are changing the Database, you need to re configure all the system settings.
Happy Programming :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.