Jump to content
bazzer747

Existing connection forcibly closed by remote host

Recommended Posts

I run many Windows applications connecting to MSSQL Servers via Firedac, and have done for many years. My 'Live' connectivity to the tables and views work OK, but in the last 2 weeks my connectivity to a 'test' Server is throwing up the error shown in the attached screenshot "An existing connection was forcibly closed by the remote host." 

In reporting this to the hosting company they are saying the 'test' Server should have no issues connecting to it, and I'm saying why, then, can I connect all my applications to the 'Live' Server with no problems, but none of these applications now connect to the 'Test' Server (when they did connect a couple of weeks ago?) 

 

They have come back with suggestions that seem to indicate using TLS1.2 may solve the issue.

 

It seems TLS1.2 and TLS1.3 are enabled by default in Windows 11 (my local PC is Windows 11 Professional), but I'm finding it difficult to verify that. And I'm thinking this is a red herring anyway.

 

My question her6e, really, is has Firedac any involvement in what version of TLS is used &/or is this something Firedac has an answer to that error?

Snap_23 June 2024_10h18m38s_005_.jpg

Share this post


Link to post

I have ODBC Driver 11 for SQL Server and ODBC Driver 17 for SQL Server on my local PC. As this message seems to relate to the 11 version, does that mean Firedac somewhere is told to use the 11 version rather than the 17 version? 

 

Could I remove the 11 version and Firedac would automatically revert to using the 17 version?

Share this post


Link to post
Posted (edited)

Unfortunately docwiki is down. I cannot comment on how you can configure SQL Server as I am not using that database. About the driver that is loaded you could try to query the FDConnection using the method GetInfoReport:

 

https://docwiki.embarcadero.com/Libraries/Sydney/en/FireDAC.Comp.Client.TFDCustomConnection.GetInfoReport

 

Google returned this https://stackoverflow.com/questions/64048094/connect-firedac-to-sql-server-through-odbc-driver-17-instead-of-sql-server-nativ:

 

1

For design time: drop a TFDPhysMSSQLDriverLink on the data module or form and set the ODBC driver to: ODBC Driver 17 for SQL Server in the drop down.

After that open your TFDConnection and switch to the Info tab and check what driver it ends up using along with any notes it mentions.

Note from the OP: To work for me I've needed to give a name to the TFDPhysMSSQLDriverLink component on its DriverID property, and set that name to the DriverName property of the TFDConnection.

Edited by Lajos Juhász
edit stackoverflow answer.

Share this post


Link to post

That's cracked it. I changed the driver to v17 (from 11) and it connects with no issues. I think the hosting company has uprated the server I couldn't connect to so it didn't allow driver v11 to connect, whilst the other two servers I had no trouble with still allowed v11 to connect OK.

 

Many thanks for your help, I can now continue with my development/text work!

Share this post


Link to post
Posted (edited)
On 6/26/2024 at 6:27 PM, bazzer747 said:

That's cracked it. I changed the driver to v17 (from 11) and it connects with no issues. I think the hosting company has uprated the server I couldn't connect to so it didn't allow driver v11 to connect, whilst the other two servers I had no trouble with still allowed v11 to connect OK.

  

Many thanks for your help, I can now continue with my development/text work!

Great to hear that changing the driver to v17 resolved the connection issue! It sounds like the hosting company upgraded the server, causing v11 to fail. For anyone needing reliable hosting services, you can buy VPS online from HostNoc to ensure seamless connectivity. Thanks for your help, and good luck with your development work!

Edited by Davidmenk3

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×