Error Description:
I had installed SQL SERVER 2014 Express edition and I was
trying to connect to SQL SERVER from Java program using JDBC, but I was
repeatedly getting following error:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP
connection to the host localhost, port 1433 has failed. Error:
"connect timed out. 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.".Error while closing connection !!null
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:241)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2243)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:491)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1309)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(Unknown
Source)
at java.sql.DriverManager.getConnection(Unknown
Source)
at Testing.main(Testing.java:42)
SQLServerException: The TCP/IP connection to the host
[name], port 1433 has failed. Error: “Connection refused: connect. Verify the
connection properties, check that an instance of SQL Server is running on the
host and accepting TCP/IP connections at the port, and that no firewall is
blocking TCP/IP connections to the port.”
Solution:
1.
Run the SQL Server Configuration Manager.
2.
Expand the SQL Server 2005 Network Configuration
item.
3.
Select the Protocols for SQLEXPRESS item.
4.
Right-click on TCP/IP.
6.
Next, right-click on TCP/IP and choose
Properties.
7.
Click on the IP Addresses tab.
8.
In the IPALL section, enter the port number 1433
in the TCP Portfield
9.
Click Apply.
10.
Click OK.
11.
Close the SQL Server Configuration Manager.
12.
Finally go to the Windows Control Panel >
Administrative Tools > Services area and Stop and then Start the SQL Server
(Express) service for the changes to take effect.
No comments:
Post a Comment