[Microsoft] [SQL Server Driver for JDBC] Error establishing socket Errors Resolution summary

Source: Internet
Author: User
Tags odbc sql server driver mssql

Today to do a special business processing, with the JDBC connection SQL Server database load driver, reported the following error:

Java.sql.SQLException: [Microsoft][sqlserver Driver for Jdbc]error establishing socket.at Com.microsoft.jdbc.base.BaseExceptions.createException (Unknown Source) at Com.microsoft.jdbc.base.BaseExceptions.getException (Unknown Source) at Com.microsoft.jdbc.base.BaseExceptions.getException (Unknown Source) at Com.microsoft.jdbc.sqlserver.tds.tdsconnection.<init> (Unknown Source) at Com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open (Unknown Source) at Com.microsoft.jdbc.base.BaseConnection.getNewImplConnection (Unknown Source) at Com.microsoft.jdbc.base.BaseConnection.open (Unknown Source) at Com.microsoft.jdbc.base.BaseDriver.connect (Unknown SOURCE) at Java.sql.DriverManager.getConnection (Unknown source) at Java.sql.DriverManager.getConnection (Unknown Source) at App.specialSupervise.power.keywork.SendMessageDao.insert (sendmessagedao.java:68) at App.specialSupervise.power.keywork.SendMessageCmd.insert (sendmessagecmd.java:15) at SUN.REFLECT.NATIVEMETHODACCESSORIMPL.INVOKE0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source) at Sun.reflect.DelegatingMethodAccessorImpl.invoke ( Unknown source) at Java.lang.reflect.Method.invoke (Unknown source) at Com.icore.util.CoreDaoFactory.invoke ( coredaofactory.java:117) at Com.icore.util.CoreDaoFactory.invoke (coredaofactory.java:135) at Com.icore.core.CommandPool.invoker (commandpool.java:92) at Com.icore.core.CommandPool.handler (Commandpool.java : 122) at Com.inspur.core.action.c.handler (c.java:213) at Com.icore.core.CoreAction.handler (coreaction.java:234) at Com.icore.http.httpserverhandler$resthandler.dohandler (httpserverhandler.java:267) at Com.icore.http.httpserverhandler$resthandler.handler (httpserverhandler.java:254) at Com.icore.core.ThreadPoolBean.run (threadpoolbean.java:57) at java.util.concurrent.threadpoolexecutor$ Worker.runtask (Unknown source) at Java.util.concurrent.threadpoolexecutor$worker.run (Unknown source) at Java.lang.Thread.run (Unknown Source)


One, configuration error
The JDBC Configuration statement is: jdbc:microsoft:sqlserver://server_name:1433
The SQL Server, server_name, and port numbers are carefully watched.

Two, 1433 port issues
You can use the command "Netstat-an" to see if 1433 ports are open, and if not, add a port.
To keep the port in the JDBC Configuration statement (jdbc:microsoft:sqlserver://server_name:1433) the same as the default port for the database transport protocol.
MSSQL set the port number steps as follows:
1. Open Enterprise Manager, and then, in the console root->microsoft SQL Servers->sql server Group, List A subset of the database servers.
2. Right click on the database server that we want to connect, select Properties, and on the General tab click Network Configuration to pop up the new window.
3. In the Enabled protocols area we select TCP/IP, click the Properties button and pop up the new window. In this window there is the network protocol default setting, the general default port is: 1433. If the port number you used in the URL differs from this one, an error will occur. should remain the same.

Three, 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's 8.00.194, it's not patched yet.
8.00.760 is SP3.
8.00.2039 is SP4.

1, download MSSQL Service Pack 3a and install, SQL please choose the hybrid installation mode!!!
Http://www.microsoft.com/downloads/details.aspx?FamilyId=90DCD52C-0488-4E46-AFBF-ACACE5369FA3&displaylang=zh-cn
After you unzip the upgrade package for SP3, click Setup to install it. To successfully upgrade to SP3.
2. Download SQL Server Driver for JDBC Service Pack 3
http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en


Iv. system firewall or anti-virus software
If the system is open firewall or anti-virus software, in some cases can also appear similar problems.
Not met, someone said so.

V. Data-driven version or writing does not correspond

Check the data-driven version (some minor differences in the sql2005,sql2000 driver notation) If the port pair is not connected to it.
Pure Java driver:
Version 2005:
Drive: Class.forName ("Com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection: "jdbc:sqlserver://localhost:1433;databasename=pubs", "sa", "sa"
Version 2000:
Drive: Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection: "jdbc:microsoft:sqlserver://localhost:1433;databasename=pubs", "sa", "sa"
JDBC-ODBC Bridge Connection:
Drive: Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver");
Connection: Jdbc:odbc:test

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

[Microsoft] [SQL Server Driver for JDBC] Error establishing socket Errors Resolution summary

Related Article

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.