问题
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.".
I have Checked the SQL Server Configuration Manager TCP/IP is Enabled.But Still I am Facing same issue.I have added sqljdbc4.0.jar
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="jdbc:sqlserver://localhost:1433;databaseName=Sample;" />
<property name="username" value="someValue" />
<property name="password" value="someValue" />
</bean>
Can Some Help me to solve the above issue
回答1:
.Thanks all you for your response.Issue has been Resolved.Followed the below steps to allow windows firewall
1) On the Start menu, click Run, type WF.msc
, and then click OK.
2) In the Windows Firewall
with Advanced Security, in the left pane, right-click Inbound Rules
, and then click New Rule in the action pane (upper right corner). In the Rule Type dialog box, select Port, and then click Next.
3) In the Protocol
and Ports
dialog box, select TCP
. Select Specific local ports, and then type the port number of the instance of the Database Engine, In my case we are using the default which is 1433
. Click Next.
4) In the Action dialog box, select Allow the connection, and then click Next. In the Profile dialog box, I am going to Leave Domain turned on and turn private and public off. Then click Next
5) In the Name dialog box, type "Allow SQL 1433 Inbound”
and for a description I am putting in the same. Then click Finish -
Restart the SQLServer(MSSQLServer)
Service and try Again.
This will Work
来源:https://stackoverflow.com/questions/24592717/error-connection-refused-connect-verify-the-connection-properties