Confluence 7.x throws "Can't reach database server or port" error when connecting to Microsoft SQL server
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Confluence 7.x displays the following error message to administrators when connecting to a Microsoft SQL database:
OR Confluence fails to start and you see a similar error to the below in the logs after upgrading and starting confluence.
SQLState - 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Server chose TLSv1, but that protocol version is not enabled or not supported by the client."
Environment
Confluence 7.1.0 and above
- Microsoft SQL Server 2014 and older versions
Diagnosis
This message appears when Confluence 7.x attempts to connect the Microsoft SQL server but failed.
SQLState - 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Server chose TLSv1, but that protocol version is not enabled or not supported by the client."
You will see a similar error in the logs as well.
Cause
This is because, since Confluence 7.1.0 we introduced the below JVM arguments as TLSv1 is no longer secure:
-Djdk.tls.server.protocols=TLSv1.1,TLSv1.2 -Djdk.tls.client.protocols=TLSv1.1,TLSv1.2
Workaround
In Windows, Confluence running as a service:
Identify the name of the service that Confluence is installed as in Windows (Go to Control Panel > Administrative Tools > Services)
We are expecting to see a service name like this Confluence251017164028
Open the command window (Choose Start > cmd.exe)
cd to the bin directory of your Confluence installation folder and run the following command:
tomcat9w.exe //ES//%service_name%
- Click on the Java tab to see the list of current start-up options
In the Java Options box, update
from:
-Djdk.tls.server.protocols=TLSv1.1,TLSv1.2 -Djdk.tls.client.protocols=TLSv1.1,TLSv1.2
to:
-Djdk.tls.server.protocols=TLSv1,TLSv1.1,TLSv1.2 -Djdk.tls.client.protocols=TLSv1,TLSv1.1,TLSv1.2
Restart the service
For more details, please refer to Configuring System Properties - Windows service
In Linux:
- Open the setenv.sh from Confluence installation folder
- Edit the following line
From
CATALINA_OPTS="-Djdk.tls.server.protocols=TLSv1.1,TLSv1.2 -Djdk.tls.client.protocols=TLSv1.1,TLSv1.2 ${CATALINA_OPTS}"
To
CATALINA_OPTS="-Djdk.tls.server.protocols=TLSv1,TLSv1.1,TLSv1.2 -Djdk.tls.client.protocols=TLSv1,TLSv1.1,TLSv1.2 ${CATALINA_OPTS}"
- Restart Confluence
Permanent fix
Enable TLS 1.2 support, for more details, please refer to TLS 1.2 support for Microsoft SQL Server