The TCP/IP connection to the host localhost, port 1433 has failed.

Have you ever encountered such an error?

The TCP/IP connection to the host localhost, port 1433 has failed.
   
   
    
    
  • 1

Write picture description here

com.microsoft.sqlserver.jdbc.SQLServerException: 
The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. 
Verify the connection properties.
Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. 
Make sure that TCP connections to the port are not blocked by a firewall.".
   
   
    
    
  • 1
  • 2
  • 3
  • 4
  • 5

Solution:

1. Select This Computer –> Right-click Management –> Computer Management –> Services and Applications
   (1) First check sql serverwhether the service has been started
Go to –>SQL Server Configuration Manager –>SQL Server Service to ensure that the local Sql Serverservice has been started.
Write picture description here
   (2) Check sql serverthe network configuration again
and go to –> SQL Server Configuration Manager –> SQL Server Network Configuration to ensure Named Pipesthat TCP/IPthe protocol is enabled.
Write picture description here
2. We run the program again, and the connection may still fail. Continue to solve the problem: still
   see sql serverthe network configuration
to –> SQL Server Configuration Manager –> SQL Server Network Configuration, Named Pipesand TCP/IPthe protocol is enabled, select TCP/IPthe right button – >Properties–>IP Address, scroll down and check IPALLwhether TCP端口it is 1433. If not, change it to 1433 1433.
Write picture description here
Finally, restart SQL Serverthe service and then run the program again. It is successful and comfortable!
Write picture description here

What I use is: jdk1.7
(corresponding resources will be posted tomorrow)
database driver jar package and jdk1.7 download

Have you ever encountered such an error?

The TCP/IP connection to the host localhost, port 1433 has failed.
   
   
  
  
  • 1

Write picture description here

com.microsoft.sqlserver.jdbc.SQLServerException: 
The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. 
Verify the connection properties.
Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. 
Make sure that TCP connections to the port are not blocked by a firewall.".
   
   
  
  
  • 1
  • 2
  • 3
  • 4
  • 5

Solution:

1. Select This Computer –> Right-click Management –> Computer Management –> Services and Applications
   (1) First check sql serverwhether the service has been started
Go to –>SQL Server Configuration Manager –>SQL Server Service to ensure that the local Sql Serverservice has been started.
Write picture description here
   (2) Check sql serverthe network configuration again
and go to –> SQL Server Configuration Manager –> SQL Server Network Configuration to ensure Named Pipesthat TCP/IPthe protocol is enabled.
Write picture description here
2. We run the program again, and the connection may still fail. Continue to solve the problem: still
   see sql serverthe network configuration
to –> SQL Server Configuration Manager –> SQL Server Network Configuration, Named Pipesand TCP/IPthe protocol is enabled, select TCP/IPthe right button – >Properties–>IP Address, scroll down and check IPALLwhether TCP端口it is 1433. If not, change it to 1433 1433.
Write picture description here
Finally, restart SQL Serverthe service and then run the program again. It is successful and comfortable!
Write picture description here

What I use is: jdk1.7
(corresponding resources will be posted tomorrow)
database driver jar package and jdk1.7 download

Guess you like

Origin blog.csdn.net/weixin_47246285/article/details/130605313