Why do I get error "Client unable to establish connection: OS Error: 'Connection refused'" when using the SQL Server ODBC driver?

Check that the SQL Server instance that you're trying to connect to is running.

On the SQL Server machine, "SQL Server (instance)" will be listed in the output of the net start command, if the SQL Server instance is running.

If SQL Server is listening on a fixed TCP port, check that you can use telnet to connect to the port that you specified in the ODBC data source:

telnet hostname port

where hostname is the host name or IP address of the machine where SQL Server is running and port is the port number that you specified with the Port attribute. If the SQL Server instance is listening on this port, the output is similar to:

Connected to myserver

Escape character is '^]'

To exit from telnet, type CTRL-] and then quit.

If you don't get this output or a "Connection refused" error displays, SQL Server is not listening on the specified port. Contact your database administrator for the correct SQL Server port.

If you are using the correct port but are unable to connect with telnet, the SQL Server instance may not allow remote TCP/IP connections. Refer to Why do I get error "Client unable to establish connection: Server not configured for TCP connection?"