Initial setup of SOnarQube with MS SQL Server not working

I have followed the documentation but am unable get the SonarQube server working with MS SQL Server. It works fine with H2. AS soon as I uncomment the below entries I am unable to start the SonarQube process.
sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=SonarQube
sonar.jdbc.username=sonarqube
sonar.jdbc.password=xxx

Below are the logs when trying to start SonarQube with the above SQL settings enabled.

Log Snippet.
jvm 1 | 2020.09.14 11:58:42 INFO app[o.s.a.SchedulerImpl] Process[es] is up
jvm 1 | 2020.09.14 11:58:42 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [C:\sonarqube-8.4.2.36762]: C:\Program Files\Java\jdk-14.0.2\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=C:\sonarqube-8.4.2.36762\temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/;C:\sonarqube-8.4.2.36762\lib\jdbc\mssql\mssql-jdbc-7.4.1.jre11.jar org.sonar.server.app.WebServer C:\sonarqube-8.4.2.36762\temp\sq-process17828685245752340572properties
jvm 1 | 2020.09.14 11:59:07 INFO app[o.s.a.SchedulerImpl] Process[web] is stopped
jvm 1 | 2020.09.14 11:59:07 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
jvm 1 | 2020.09.14 11:59:07 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
wrapper | <-- Wrapper Stopped

Hi,

Welcome to the community!

What do your server logs say?

 
Ann

Here all the logs.
Thanks!

access.log (16.8 KB) ce.log (1.9 KB) es.log (50.4 KB) sonar.log (35.8 KB) web.log (143.3 KB)

Hi, here is the piece of information that will help:

Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".)

So it looks like a connectivity issue between SonarQube and your database.

Thank you. My SQL instance is listening on 1433. Everything is on the same server and all firewalls on the server are disabled. I can connect to the Database using the SQL credentials defined in the properties file without any issues.
I attached the SQL Connection configuration for reference.

1 Like

I enabled TCPIP and Named Pipes and it’s working now.
Thanks for the help.

1 Like

Glad to see it’s working for someone. Would be nice if they added things like this to the documentation for SQ. I haven’t had much luck so far with my MS SQL DB connection. I have enabled TCP and Named Pipes, disabled firewall, and followed all of the install guidance that I can find, but no luck. It works for me with the embedded DB, but not with MS SQL Integrated Security, nor with SQL Auth with username & password defined in the properties.

If anyone else has experienced these issues and have some ideas, please share. Also, SQ team, please start a FAQ or Troubleshooting steps for these issues and link it to the Install Server documentation for future reference. Thanks!

@sqneedsbetterguides have you checked your server logs?

 
Ann

1 Like

Ann, after combing through the logs I was able to determine my issue and fixed it, now my server works with the MS SQL Integrated Security authentication. Thanks for your words of wisdom!
I had created a new database for troubleshooting and forgot to set the collation on the new database, it was set to the default, so I got this error in the web log:

Initialization of bean failed; nested exception is Database collation must be case-sensitive and accent-sensitive. It is SQL_Latin1_General_CP1_CI_AS but should be SQL_Latin1_General_CP1_CS_AS.

I fixed this and tried again, and it worked!!! Whew~~~ what a process.
This final error was my bad, but many of these issues could have been better explained with screenshots in the Install the Server guide, with a link to some common troubleshooting steps. Not only “check the logs” but what specific things to find in the logs, maybe common sense stuff to some, but others would benefit greatly from screenshots for sure. I had no idea about how to set the TCP/IP and Named Pipes settings to Enabled and check the port it’s using until evero :love_you_gesture: posted a screenshot of that. Stuff like this could be added into the documentation to make it easier for those with less experience.

Anyway, thank you very much for your continued help and forcing me to check my logs.

v/r

James

1 Like

Hi @sqneedsbetterguides, thanks for letting us know about this. Great find on setting the new collation!

I’ve created a ticket to call out these steps for the Documentation Team. It’s in our backlog and we’ll integrate it into an upcoming sprint.

1 Like