Install Sonar on Windows connected to a MSSQL-Database

To run Sonar on Windows connected to a MSSQL-Database there are a few things to be known:
In my example I installed Sonar to a 64bit Windows machine. But as for other reasons the <JAVA-HOME>-PATH-variable pointed to a 32bit Java installation I installed the 32bit Sonar.

Download sonar from and extract it to Your program folder (<sonar>)
Open the MSSQL-Administrator and create a database called "SONAR"
Edit the file <sonar>/conf/
Insert the database user and its password:
sonar.jdbc.username: <user>
sonar.jdbc.password: <password>

As Sonar comes with Derby support comment or delete everything concerning Derby:
# Comment the following lines to deactivate the default embedded database.
#sonar.jdbc.url: jdbc:derby://localhost:1527/sonar;create=true
#sonar.jdbc.driverClassName: org.apache.derby.jdbc.ClientDriver
#sonar.jdbc.validationQuery: values(1)

Uncomment and insert the data for the connection to the MSSQL-database:
#----- Microsoft SQLServer
# The Jtds open source driver is available in extensions/jdbc-driver/mssql. More details on
# The validation query is optional.
sonar.jdbc.url: jdbc:sqlserver://<database server>;databaseName=SONAR;instanceName=<database instance>;selectMethod=cursor;
sonar.jdbc.validationQuery: select 1

Set the value of SQL-dialect to mssql further downwards in the file:
# Values are : mysql, mssql, derby, oracle, postgresql
sonar.jdbc.dialect= mssql

Save the file <sonar>/conf/
Go to the directory: <sonar>/extensions/jdbc-driver/mssql
Delete the existing driver: jtds-1.2.4.jar
Download and unzip the file sqljdbc_3.0.1301.101_enu.exe or sqljdbc_3.0.1301.101_enu.tar.gz from
Copy the file sqljdbc4.jar from the unzipped data into the driver directory of Sonar (<sonar>/extensions/jdbc-driver/mssql).
Now start Sonar for the first time by double clicking <sonar>/bin/windows-x86-32/StartSonar.bat
The database will be created but you will expierence some errors. So stop Sonar again.
Open the MSSQL-Administrator and change the settings of following rows from nvarchar to ntext: (ntext)
Now start Sonar again; it should run without errors.
You can install Sonar as a NT-Service by double clicking <sonar>/bin/windows-x86-32/InstallNTService.bat
If the service will not run without errors, navigate to the NTService Administration, stop Sonar and let it run with an account that owns a temp directory. (see:

I hope I could help You!