3.1 SonarQube - SQL Server configuration
Last updated
Was this helpful?
Last updated
Was this helpful?
SQL Setup: Validate the SQL install. Open SSMS and connect to the sql server instance - .\MSSQLServer
Validate the SQL Instance & Service name
Database: Create a new database ‘sonar’ (all lowercase)
This database collation needs to be Case Sensitive (CS) & Accent Sensitive (AS) - choose Latin1_General_CS_AS.
The collation can be checked by running the following t-sql
Warning! SQL Server 14 Express, SQL Server Management Studio, and SQL 2014 LocalDB are separate downloads, make sure you actually installed SQL Server and not just the Management Studio! http://www.microsoft.com/en-us/download/details.aspx?id=42299
SonarQube Service User: Create a new windows user ‘SonarUser’. Give this user approprite permissions to the machine. Set this user up for access in the newly created database instance. Run the following command to check the permissions this user has in the database instance. Create a login for this user and permission this user with appropriate permission on the newly created sonar database to be able to create the schema.
Static Port: In the default configuration of SQL Server, Dynamic port are enabled. SonarQube expects a static port to route the requests. Log into SQL Server configuration manager and follow the instructions here to enable the TCP/IP and disable dynamic ports. https://msdn.microsoft.com/en-GB/library/ms177440.aspx
At this point we have all the pre-requisites installed & successfully configured. If any of the configuration validations have failed try restarting the machine and running the validations again…
Navigate to the earlier download location of SonarQube. Right click the zip file and choose unblock.
Unzip the file and copy the binaries to the folder C:\SonarQube\
Open the SonarQube properties file sonar.properties from the following location C:\SonarQube\sonarqube-6.7.1\conf.
In the sonar.properties file look for ‘#—– Microsoft SQLServer 2008/2012/2014 and SQL Azure’. This needs to have the connection string for the sql server database you intend to use.
Update the section by adding the connection string of the database
For Integrated Security to work, you have to download the Microsoft SQL JDBC driver package from
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
and copy sqljdbc_auth.dll to your system32 folder.
Launch a command prompt as administrator. Navigate to C:\SonarQube\sonarqube-6.7.1\bin\windows-x86-64 and run the below listed command.
At this point you should see the SonarQube running up in a local webserver mode. Open a browser and navigate to http://localhost:9000. Since this is the first time, SonarQube will deploy the schema to the sonar database.
SonarQube uses 9000 as the default port, you can change this to another port from the sonar.properties file.
Remember to look into the log file located at C:\SonarQube\sonarqube-6.7.1\logs if you run into any exceptions. The error messages are quite well documented.
If you accidentally left the database collation to case insensitive you are bound to hit some exceptions…
If the database has set up with case insensitive or there are issues with the user permissions expect to see exceptions. The best way to get to the bottom of the issue is to look at the log file available here… C:\SonarQube\sonarqube-6.7.1\logs.