Wednesday, January 10, 2024

SQL Server Exception!! This time with a Java application though

As a systems integration specialist, i have been working with various enterprise scale application and sometimes we do end up integrating to legacy systems to either pull data that can be ingested later into the cloud based system (SAAS application).

In todays' article i am going to explain the problem i faced while integrating to a legacy Sql server database restored over a more recent version of Sql server resulting in database connection failure and how we overcome that particular connectivity issue without rolling back to an old version of Sql Server. 

To start with, here is the error message encountered when we tried to connect to Sql Server 2022 using one of the inhouse JAVA application: -

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host <hostname excluded>, port 1433 has failed.

Further stack trace revealed this: -

Error: "Connect timed out. 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.".

First thing that comes to mind here is to cross check if there are any firewalls blocking the connectivity and that thought quickly vanishes as i was able to connect via SSMS (Sql Server management studio)







Second thought was to cross check Sql Server Native Client configuration since the JAVA application was relying on native client libraries to connect to the instance of Sql Server.

so we opened Sql Server 2022 configuration manager and navigated to SQL Native Client 11.0 configuration which was empty considering the fact that Microsoft has removed this from Sql Server 2022: -






To resolve this, you may manually install the latest servicing release of native client from here: -

https://www.microsoft.com/en-us/download/details.aspx?id=50402


Once installed, you should be able to see the client protocols available under configuration manager: -