Summary error of JDBC connection to sqlserver establishing socket

Source: Internet
Author: User

When MSSQL is used to connect to the database, the error "Error establishing socket." is often encountered. The error log information is as follows:

SQL code
  1. Java. SQL. sqlexception: [Microsoft] [sqlserver 2000 driver for JDBC] Error establishing socket.
  2. At com. Microsoft. JDBC. Base. baseexceptions. createexception (unknown source)
  3. At com. Microsoft. JDBC. Base. baseexceptions. getexception (unknown source)
  4. At com. Microsoft. JDBC. Base. baseexceptions. getexception (unknown source)
  5. At com. Microsoft. JDBC. sqlserver. TDS. tdsconnection. <init> (unknown source)
  6. At com. Microsoft. JDBC. sqlserver. sqlserverimplconnection. Open (unknown source)
  7. At com. Microsoft. JDBC. Base. baseconnection. getnewimplconnection (unknown source)
  8. At com. Microsoft. JDBC. Base. baseconnection. Open (unknown source)
  9. At com. Microsoft. JDBC. Base. basedriver. Connect (unknown source)
  10. At java. SQL. drivermanager. getconnection (drivermanager. Java: 523)
  11. At java. SQL. drivermanager. getconnection (drivermanager. Java: 171)
  12. At test. sqlservertest. Main (sqlservertest. Java: 29)
java.sql.SQLException : [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. 



I found on the Internet that the problem can be solved in the following ways:

1. Configuration Error

JDBC configuration statement: JDBC: Microsoft: sqlserver: // SERVER_NAME: 1433

The sqlserver, SERVER_NAME, and port numbers must be carefully checked.

Port 1433

You can run the "netstat-an" command to check whether port 1433 is enabled. If no port is available in the list, add the port.

Make sure that the port in the JDBC configuration Statement (JDBC: Microsoft: sqlserver: // SERVER_NAME: 1433) is the same as the default port of the database transmission protocol.

To set the port number in MSSQL, follow these steps:

1. Open the Enterprise Manager and go to the root directory of the Console> Microsoft SQL servers> SQL Server group to list some database servers.

2. Right-click the database server we want to connect to, select properties, and click network configuration on the General tab to bring up a new window.

3. In the enabled Protocol area, select TCP/IP and click Properties. A new window is displayed. In this window, you can set the default network protocol. The default port is 1433. If the port number you use in the URL is different from this, an error occurs. The two should be the same.

3. No Patching

You can view the version of MSSQL in the following ways:

Open Enterprise Manager> Tools> SQL query analyzer> help> about

View the detailed version number of MSSQL

If it is 8.00.194, no patch is installed.

8.00.760 is SP3.

8.00.2039 is SP4


1. Download and install MSSQL 2000 Service Pack 3A. Select the hybrid installation mode for SQL !!!

Http://www.microsoft.com/downloads/details.aspx? Familyid = 90dcd52c-0488-4e46-afbf-ace5107fa3 & displaylang = ZH-CN

After decompressing the SP3 upgrade package, click setup to install the package.

2. Download SQL Server 2000 driver for JDBC Service Pack 3

Http://www.microsoft.com/downloads/details.aspx? Familyid = 07287b11-0502-461a-b138-2aa54bfdc03a & displaylang = en

Four system firewalls or anti-virus software

If the system runs firewall or anti-virus software, similar problems may occur in some cases.

Never met. Someone said so.

Supplement: About

SQL Server 2000 won't be able to use SP4 patch my first original article.
Once, I installed an SQL Server 2000 Enterprise Edition on XP, and then applied the SP4 patch. After the patch was installed, I used the SQL Server Client on other machines to connect to it. If something goes wrong, run to the server and use select @ version to display 8.00.194. With fport, no program listens for 1433. Mom, the patch is not successful. This is the case no matter how many times. It's useless to set it up. No solutions can be found for Internet queries. If there is no way, I can open c: \ sql2ksp4(sql2000-kb884525-sp4-x86-chs.exe decompress the Directory) and see what is in the directory c: \ sql2ksp4 \ x86 \ binn, and C: \ Program
Files \ mocrosoft SQL Server \ MSSQL \ binn directory has the same file name. For comparison, the product version of the file is different. C: \ Program Files \ mocrosoft SQL Server \ MSSQL \ binn all files in the directory 8.00.194, c: \ sql2ksp4 \ x86 \ binn all files in the directory 8.00.2039. Does the patch cover the installation directory? I will try to overwrite it, but he won't succeed. After overwriting, restart the machine. The client is connected again. Fportinterfaces and ports have been listened by sqlserver.exe.
Conclusion: Sometimes the installation of the SQL Server SP4 patch may be abnormal and may be related to XP. It may also be related to the excessive number of security patches with the 360 patch. In this case, manual File Overwriting is also a solution.
Microsoft's product is very popular. It cannot be used without SP4 patches, nor can it be reported if it fails to be installed. There are so many major bugs that Microsoft despise. .

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.