Unable to connect to SQL over port 1433 SQL server is on same host as SonarQube

This is a first time install of SonarQube for testing use.
We have installed the SQL server on the same host as the Sonarcube Ent 10.0 and installed via the Zip file.

We have tested the connection to the DB via ODBC from the same host and it works as expected. We have installed the mssql-jdbc_auth-11.2.3.x64 into the Java home folder and the SonarQube home folders.
However, when we start the server, we see this error.

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host nameremoved, 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.”.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)

I have tried all kinds of things and cannot get this to work.

Thank you,
Justin

Hi Justin,

I’m guessing your server logs say a little bit more about this. On the face of it, the problem is your JDBC settings in SONARQUBE-HOME/conf/sonar.properties. Make sure the JDBC URL and credentials are correct there.

 
HTH,
Ann

Hi Justin,

Even if only for testing, this is not recommended. Sonarqube should run on its own deticated machine, think of performance, maintenance and backup routines…
Our Sonarqube Enterprise instance runs on a VM with Windows Server 2019.

I guess you’re on Windows - though there is a linux version for MSSQL also - where a typical Java installation is like that

JAVA_HOME=path\to\the\rootfolder\of\your\jdk
PATH=%JAVA_HOME%\bin;%PATH%

Check with cmd / powershell and java -version, Sonarqube server needs to run with Java 17
Should be something like that

openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)

All you need to do afterwards for Sonarqube 10.0 is to put the
\mssql-jdbc_auth.zip\x64\x64\mssql-jdbc_auth-11.2.3.x64.dll in %JAVA_HOME%\bin
folder and you’re done.

The dll is not needed in %SONARQUBE_HOME%, simply delete it. Sonarqube already ships with %SONARQUBE_HOME% \lib\jdbc\mssql\mssql-jdbc-11.2.3.jre17.jar which is sufficient.

Gilbert

1 Like

Sorry forgot that info. We are running windows server 2016 and are using the integrated sql setup.
The DB is reachable and is working when testing with ODBC.

In the config file this is the setting we have in place all other fields for this section are commented out.
sonar.jdbc.url=jdbc:sqlserver://alusly-sd363112;databaseName=sonar;integratedSecurity=true

We have put the mssql-jdbc_auth-11.2.3.x64.dll in the path below. The variable is set at the windows level for Java home to point here.
C:\Program Files\Microsoft\jdk-17.0.7.7-hotspot\bin

The services will start up and run however it will stop all most instant with this error in the web logs.

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host alusly-sd363112, 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.".
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
	at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
	at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2517)
	at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:778)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3300)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2950)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2790)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1663)
	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1064)
	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121)
	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)

And this error in the sonar log file.

2023.06.16 07:55:47 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory D:\SonarQube\temp
2023.06.16 07:55:47 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:58137]
2023.06.16 07:55:47 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [D:\SonarQube\elasticsearch]: C:\Program Files\Microsoft\jdk-17.0.7.7-hotspot\bin\java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=D:\SonarQube\elasticsearch -Des.path.conf=D:\SonarQube\temp\conf\es -Des.distribution.type=tar -cp D:\SonarQube\elasticsearch\lib\*;D:\SonarQube\elasticsearch\lib\cli-launcher\* org.elasticsearch.launcher.CliToolLauncher
2023.06.16 07:55:47 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.06.16 07:56:13 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2023.06.16 07:56:13 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [D:\SonarQube]: C:\Program Files\Microsoft\jdk-17.0.7.7-hotspot\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=D:\SonarQube\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 --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx1G -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-10.0.0.68432.jar;D:\SonarQube\lib\jdbc\mssql\mssql-jdbc-11.2.3.jre17.jar org.sonar.server.app.WebServer D:\SonarQube\temp\sq-process6944509419056797070properties
2023.06.16 07:56:29 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2023.06.16 07:56:29 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.06.16 07:56:29 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

I guess the windows firewall is blocking the java communication.
Did you see any popups from windows firewall when first starting Sonarqube ?

All i switched to a new SQL server and now we are up and running.

Thank you for the help on this one

1 Like