Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Installing SonarQube on Windows and SQL Server

DZone's Guide to

Installing SonarQube on Windows and SQL Server

Trying to install SonarQube on Windows and SQL Server? Here's a tutorial to get you started.

Free Resource

Modernize your application architectures with microservices and APIs with best practices from this free virtual summit series. Brought to you in partnership with CA Technologies.

Installing SonarQube on windows machine with SQL Server express as back end is quite simple, but here is some information you should know to avoid some common problem with database layer (or at least avoid problem I had).

Setting up Sonar Qube in Windows is easy, but sometimes you can encounter some problem to have it talk to SQL Server database.

First of all I avoid using integrated authentication in SQL Server, because I find easier to setup everything with a standard sql user. After all my instance of SQL Express is used only for the instance of Sonar. So I create a user called sonar with a password, and remove the check for password expiration.

Figure 1: Avoid password expiration

Then you should open Sql Server Configuration Manager, and you must enable the TCP Procol.

Figure 2: Enable TCP/IP protocol in Sql Server Configuration Manager

Now I found that Java drivers are a little bit grumpy on connecting with my database, so I decided to explicitly disable dynamic port and specify the 1433 port directly. Just double click the TCP/IP protocol shown in Figure 2 to open properties for TCP/IP protocol.

Figure 3: Disable dynamic ports and specify 1433 as TCP Port

Now create a new database called Sonar, and set user sonar as owner of the database. Place specific attention to case of Database Name. I choose Sonar with capital S.

Figure 4: Create a new database called Sonar with sonar user as owner

Now be sure to select the correct Collation, remember that you should use a collation that is Case Sensitive and Accent Sensitive, like SQL_Latin1_General_CP1_CS_AS.

Figure 5: Specify the right Collation for the database. It should be CS and AS

Now, just to be sure that everything is ok, try to connect from Management Studio using the port 1433 and with user sonar. To specify port you should use a comma between server name and the port.

Figure 6: Try to connect to the server with user sonar and port 1433

Verify that you can see Sonar database. If you are able to connect and see Sonar Db you have everything ready. Remember to download JDBC driver for MsSql at this address, once downloaded be sure to right click the zip file and in properties section unblock the file. Then unzip the content and copy the file jtds-1.3.1.jar into subfolder extensions\jdbc-driver\mssql of your Sonar Installation (the mssql folder usually does not exists and you should manually create it).

Now you should edit conf/sonar.properties file and add connection string to the database.

sonar.jdbc.username=sonar
sonar.jdbc.password=xxxxxxxxxx
sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/Sonar;SelectMethod=Cursor;instance=sqlexpress

Place specific attention to database name in connection string because it is CASE SENSITIVE, as you can see I specified sqlserver://localhost/Sonar with capital S exactly as database name. Since you are using Accent Sensitive and Case Sensitive collation is super important that the name of the database is equal in casing to the name used in connection string. If you specify wrong casing, you are not able to start Sonar and you will find this error in the sonar log.

The error: The database name component of the object qualifier must be the name of the current database. Happens if you use wrong casing in Db Name in connection string

You should be able now to start Sonar without any problem.

Gian Maria

The Integration Zone is proudly sponsored by CA Technologies. Learn from expert microservices and API presentations at the Modernizing Application Architectures Virtual Summit Series.

Topics:
integration ,ei ,enterprise integration

Published at DZone with permission of Ricci Gian Maria, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}