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

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

Do a special business today, when using JDBC to connect SQL Server database load driver, reported such as 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 detailed.

Second, 1433port problems
The ability to see if 1433port is opened by command "Netstat-an", assuming that there is no list, to open the 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 procedure for example:
1. Open Enterprise Manager. In the Console root folder->microsoft SQL Servers->sql Server Group, list some of the database servers.


2. Right-click the database server that we want to connect to. Select Properties. On the General tab, click Network Configuration to eject the new form.
3. In the Enabled protocols area we select TCP/IP and click on the Properties button. The new form pops up. In this form there is a network protocol default setting, the general default port is: 1433. Assuming you have a different port number in the URL, an error will occur.

should remain the same.


Three, no patching
The version number of the MSSQL can be viewed in the following way:
Open Enterprise Manager-〉 Tools-〉sql Query Analyzer-〉 help-〉 about
View the specific version of MSSQL
Assuming it's 8.00.194 or not patched.
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 SP3 upgrade package, click Setup to install it. Ability 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
Suppose the system is open firewall or anti-virus software, in some cases can also appear similar problems.
Not met, someone said so.

Data-driven version number or incorrect wording should be

If the port pair is not connected, check the data-driven version number (some minor differences in the sql2005,sql2000 driver notation)
Pure Java driver:
2005 Version Number:
Drive: Class.forName ("Com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection: "jdbc:sqlserver://localhost:1433;databasename=pubs", "sa", "sa"
2000 Version Number:
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

[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.