Docker Container - MSSQL connection error

Hi all,

I’ve been battling with trying to get SonarQube to connect to my MSSQL instance on my machine. The idea would be to move away from the internal H2 db and replace it with my MSSQL instance.

Configuration - SQL Server

  • Version: SQL 2012 R2 Enterprise Edition

  • I tried SQL Express 2016 as well

I’ve created a database called SonarQube with SQL credentials.

Configuration - Docker

  • Image: sonar:8.2-community

Configuration - Docker command - this is run from a powershell script
docker run -it --name sonarqube `

-p 9000:9000 -p 1433:1433 -e SONARQUBE_JDBC_USERNAME="sql_username"
-e SONARQUBE_JDBC_PASSWORD=“sql_password” `

-e SONARQUBE_JDBC_URL=“jdbc:sqlserver://192.168.8.100:1433;databaseName=SonarQube;instanceName=sqlexpress;”

-e ‘ACCEPT_EULA=Y’ `

26e081fb0a96

What’s currently happening
When I run the command above, I’m getting an error while connecting to the DB - checking the stackTrace, I see this:

2020.04.15 15:26:51 INFO web [o.sonar.db.Database] Create JDBC data source for jdbc:sqlserver://192.168.8.100:1433;databaseName=SonarQube;instanceName=sqlexpress;
2020.04.15 15:26:52 ERROR web [o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Fail to connect to database
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:87)

Caused by: org.sonar.api.utils.MessageException: Unsupported mssql version: 11.0. Minimal supported version is 12.0.

I can connect to the instance from SQL Server management studio. Please can someone assist me where to check next?

Regards,
Charles

Hey Charles

Indeed – SQL Server 2012 is not supported (and the Requirements Documentation will tell you that much)!

I’d expect that error when using SQL Server 2012, but not 2016 (which is a supported version). Are you sure you receive the exact same error when you use SQL Server 2016?

Hey Colin,

Nope. I disabled my 2012 version and enabled the SQL Server 2016.
The docs do help - :sweat_smile:

Thanks for the help mate.

1 Like