Error while performing indexing using DataImportHandler
Question
You receive the following error when trying 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 the steps below to resolve this issue:
1. Open SQL Server Configuration Manager
Press Windows Key + R to open the Run dialog.
2. Run the Configuration Manager for your SQL Server version
Use the appropriate command:
SQLServerManager15.msc→ SQL Server 2018SQLServerManager14.msc→ SQL Server 2017SQLServerManager13.msc→ SQL Server 2016SQLServerManager12.msc→ SQL Server 2014SQLServerManager11.msc→ SQL Server 2012SQLServerManager10.msc→ SQL Server 2008

Note: If SQL Configuration Manager is not found, verify your SQL Server installation.
3. Expand: SQL Server Network Configuration

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

5. Restart SQL Server Services
Restart the SQL service so changes take effect.
