Installing SonarQube on Windows and SQL Server
Trying to install SonarQube on Windows and SQL Server? Here's a tutorial to get you started.
Join the DZone community and get the full member experience.Join For Free
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.
Published at DZone with permission of Ricci Gian Maria, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.