Sonarqube connection to SQL SERVER EXPRESS

Sonarqube 8.1 connection to SQL SERVER EXPRESS

Hi. I’ve been trying to connect SonarQube (container) to SQL Server Express (which is also in a container).
I’m having an issue regarding the command line used to upload SonarQube.

docker run -d --name sonarqube --link sql:sqlserver -p 9000:9000 -p 9092:9092 -e SONARQUBE_JDBC_USERNAME=sa -e SONARQUBE_JDBC_PASSWORD=P@ssw0rd -e “SONARQUBE_JDBC_URL=jdbc:sqlserver://localhost;databaseName=sonarqube;” sonarqube

Upon execution, a log file is generated containing the following error:

“SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: “Connection refused (Connection refused). 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.”.”

I’ve already checked Username and Password, they’re both correct. The command I utilized was the one that follows:
docker run -e “ACCEPT_EULA=Y” -e “SA_PASSWORD=P@ssw0rd” -p 1433:1433 --name sql -d mcr.microsoft.com/mssql/server:2019-GA-ubuntu-16.04

It was properly created, so much so that I made the connection to my machine’s SQL server.

The DB was built with the following query:
CREATE DATABASE sonarqube COLLATE Latin1_General_100_CS_AS_SC

I believe the problem might be in the connection string, I’m just not sure how to use it…

Thanks!

You need to Enable TCP/IP Protocol.

  1. Open SQL Server Configuration Manager
  2. Expand SQL Server Network Configuration .
  3. Select Protocols for XX.
  4. Right-click TCP/IP and select Enable .
    Hope this helps