Article ID: 313178 - View products that this article applies to.
This article was previously published under Q313178
When you try to make a connection to SQL Server 2000 by using the Microsoft SQL Server 2000 Driver for JDBC, you may receive the following error message:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
The following are some of the most common reasons why this error can occur, and how to determine if one of these reasons applies to your connection:
The server name or IP address is incorrect.
To test basic connectivity to your server, use the ping command from a command prompt. This will verify that you have network connectivity to that server, but it will not confirm if the SQL Server can accept connections.
The server name is correct, but the server is not running.
You can verify whether or not your server is running from the SQL Server Network Utility on the server, or from another client utility such as SQL Query Analyzer, or a command line utility such as osql.
For more information about these tools, see SQL Server Books Online.
The server name is correct and it is running, but the server does not have TCP/IP enabled.
To check the enabled protocols for a server, follow these steps:
NOTE: The driver does not connect to a named instance by name. You must use the port number to connect to the named instance. To find the SQL Server instance port number, follow these steps:
313225If the problem is intermittent, it might be due to network problems or due to server problems (for example, the server is occasionally too busy to accept a connection). When the problem occurs, check to see if you can connect to the same server instance from another client, such as SQL Query Analyzer. It may also be useful to use a Network Sniffer such as Network Monitor (NetMon) to monitor traffic between the client and the server to determine if there is a network problem.
(http://support.microsoft.com/kb/313225/EN-US/ )HOWTO: Connect to a SQL Server 2000 Named Instance with JDBC
For additional information about using NetMon, click the article number below to view the article in the Microsoft Knowledge Base:
148942If the problem is not intermittent, it might still be a network configuration problem. For example, you may be behind a firewall that blocks certain ports.
(http://support.microsoft.com/kb/148942/EN-US/ )How to Capture Network Traffic with Network Monitor
For additional information about configuring SQL Server to work behind a firewall, click the article number below to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/287932/EN-US/ )INF: TCP Ports Needed for Communication to SQL Server Through a Firewall
Article ID: 313178 - Last Review: October 30, 2003 - Revision: 3.2