Sqlserver connection Error

Source: Internet
Author: User
This problem was encountered when I first used Java to connect to SqlServer2008. I have searched many articles on this issue on the Internet. Com. microsoft. sqlserver. jdbc. SQLServerException: connection to the TCPIP of the host localhost through port 1433 fails. Error: "Connectionrefused: connect. Verify connection

This problem was encountered when I first used Java to connect to SqlServer 2008. I have searched many articles on this issue on the Internet. Com. microsoft. sqlserver. jdbc. SQLServerException: The TCP/IP connection to the host localhost through port 1433 fails. Error: "Connection refused: connect. Verify connection

This problem occurs when I first used Java to connect to SQL Server 2008. I have searched many articles on this issue on the Internet.

Com. microsoft. sqlserver. jdbc. SQLServerException: The TCP/IP connection to the host localhost through port 1433 fails. Error: "Connection refused: connect. Verify the Connection Properties, check that the SQL Server instance is running on the host, accept the TCP/IP connection on this port, and ensure that the firewall does not block the TCP connection to this port .".

At com. microsoft. sqlserver. jdbc. SQLServerException. makeFromDriverError (SQLServerException. java: 171)

At com. microsoft. sqlserver. jdbc. SQLServerConnection. connectHelper (SQLServerConnection. java: 1033)

At com. microsoft. sqlserver. jdbc. SQLServerConnection. login (SQLServerConnection. java: 817)

At com. microsoft. sqlserver. jdbc. SQLServerConnection. connect (SQLServerConnection. java: 700)

At com. microsoft. sqlserver. jdbc. SQLServerDriver. connect (SQLServerDriver. java: 842)

At java. SQL. DriverManager. getConnection (Unknown Source)

At java. SQL. DriverManager. getConnection (Unknown Source)

At TestSql. main (TestSql. java: 11)

The general solution is as follows:

SQL Server Configuration Manager → SQL Server network configuration → set the TCP/IP protocol status to started, right-click the TCP/IP protocol → properties → IP address → the last option IPALL, set the TCP port to 1433 (this can also be another port, but it must correspond to it in the program, generally 1433 ). Restart the SQL Server service.

In addition, pay attention to reference jdbc4.jar When referencing the driver package.

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.