Question:


 I get below error when I try to index data using DataImportHandler


com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: 
"Connection refused: connect. 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.


Solution:


Follow below steps to resolve the error:


1. Click  Windows key + R and open the Run window.


2. Execute below command according to you SQL Server Version :  


  • SQLServerManager15.msc for [SQL Server 2018]
  • SQLServerManager14.msc for [SQL Server 2017]
  • SQLServerManager13.msc for [SQL Server 2016]
  • SQLServerManager12.msc for [SQL Server 2014]
  • SQLServerManager11.msc for [SQL Server 2012]
  • SQLServerManager10.msc for [SQL Server 2008]





[Note: If you do not find SQL Configuration Manager,  please check here ]


3. Expand SQL Server Network Configuration.



4. Right-click TCP/IP and  select Enable.



5. Restart your SQL Server Services.