Confluence 7.4.0 can't connect to SQL Server
Asked by tamarayee:

I'm getting this error in the Confluence app log:

```
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS12, TLS11]".
```

Any thoughts on where the problem is? Is it the SQL Server that can't accept secure connections, or is the fault in Tomcat or the JRE? What is determining the "server selected protocol version"? Any direction would be great.

I'm running on Windows Server 2012 R2, SQL Server 2014 (12.0.2000.8 (X64)), upgrading from Confluence server version 5.x to 7.4.0. The SQL Server is on the same server as Confluence. The database works fine from SQL Server Management Studio using the same username and password as configured for Confluence. I've applied the latest required Windows Updates + some optional .NET Framework updates. I've not yet applied the service packs for SQL Server 2014.


Answers:
author: Moses Thomas
body: [@tamarayee](/t5/user/viewprofilepage/user-id/930819)

This errors occurs due to the fact that new JVM arguments are introduced in the later version as TLSv10 is no longer secure:

It looks like you have fall into similar issue here, you can apply the workaround here.

[Confluence 7.1.0 throws "Can't reach database server or port" error when connecting to Microsoft SQL server](https://confluence.atlassian.com/confkb/confluence-7-1-0-throws-can-t-reach-database-server-or-port-error-when-connecting-to-microsoft-sql-server-980467198.html?_ga=2.199826542.1115832344.1588856494-231509564.1588856494)

Kind regards,

Mo

comments: author: tamarayee
body: Thanks very much for your reply! I actually did find that. I updated setenv.sh based on that. Oops, I guess that was only for Linux :P

I updated that successfully, and now I get this. This seems like a bad error :( The SQL login configured in confluence.cfg.xml currently has the sysadmin role on the SQL Server.

```
com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.MsSqlServerAoUpgradeTask@7b7446b3 failed during the SCHEMA_UPGRADE phase due to: StatementCallback; uncategorized SQLException for SQL [DROP INDEX "AO_6384AB_FEATURE_METADATA_AO"."index_ao_6384ab_fea1458039816";]; SQL state [S0007]; error code [3701]; Cannot drop the index 'AO_6384AB_FEATURE_METADATA_AO.index_ao_6384ab_fea1458039816', because it does not exist or you do not have permission.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Cannot drop the index 'AO_6384AB_FEATURE_METADATA_AO.index_ao_6384ab_fea1458039816', because it does not exist or you do not have permission.
```

After restarting again, I get a bunch of these:

```
com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.DropSpaceGroupTablesUpgradeTask@3183b1b failed during the SCHEMA_UPGRADE phase due to: null
```

Any ideas?

To get around a certificate error I was getting, I added "secure=false" to the JDBC connection string in confluence.cfg.xml. Could that cause problems?


author: Moses Thomas
body: [@tamarayee](/t5/user/viewprofilepage/user-id/930819) Actually NO, There is for Windows please check the link properly, you have updated file for Linux ;) , you must undo what you have change in that file and apply work around mentioned for Windows


author: tamarayee
body: Hi [@Moses Thomas](/t5/user/viewprofilepage/user-id/1138700) are you referring to setenv.sh? I said I realized that and did the Windows solution successfully. It revealed another problem I mentioned. Can you help with that too?


author: Moses Thomas
body: [@tamarayee](/t5/user/viewprofilepage/user-id/930819)

Aaa Ok now i get your text. This Bug is a Known issue, I assume the you have Confluence below 5.10.9 you have mentioned 5.x, further ticket info is registered here.

[Upgrading Confluence v5.0.3 to v7.2 fails on MS SQL Server](https://jira.atlassian.com/browse/CONFSERVER-59560)
>
> ### Workaround {#toc-hId-1145363000}
>
> Upgrade to 5.10.9 and then upgrade to 7.4.0 using installers
>
Kind regards,

Moses


author: tamarayee
body: [@Moses Thomas](/t5/user/viewprofilepage/user-id/1138700) Thanks! Do I need to roll back first, or can I just try installing 5.10.9 over the current installation?


author: Moses Thomas
body: [@tamarayee](/t5/user/viewprofilepage/user-id/930819) In-fact i can't propose installing 5.10.9 over the current installation rollback is better so you don't fall into mess. I hope that you have backup your Confluence before upgrade.

Here is a guide to perform roll back then upgrade -\> 5.10.9 -\> 7.4.0

[How to roll back to a previous version of Confluence](https://confluence.atlassian.com/confkb/how-to-roll-back-to-a-previous-version-of-confluence-316113136.html)

Good luck and please give feed back.

Kind regards,

Mo


author: tamarayee
body: [@Moses Thomas](/t5/user/viewprofilepage/user-id/1138700) Thank you SO much! I'm up and running! There are still a lot of errors in the logs, but it seems to work from the user's perspective, so I hope it doesn't matter.


author: Moses Thomas
body: [@tamarayee](/t5/user/viewprofilepage/user-id/930819) Great i am happy :) , Just like every application there are errors base on several actions(such as POST, GET, HEAD request, out going mails, incoming and so on...) some of the errors are normal and does no harm to Confluence but some need to be fix by configuring Confluence properly so you will need to separate errors that are threat to performance and those that are not and then fix them one by one. But since you are up and running then we should smile.

Have a great weekend ahead.

Kind regards,

Mo


Tags: server