如何使MS SQL Server能够连接?

27

我正在尝试从Java程序连接到运行在我的计算机上的MS SQL Server。但是我收到了以下异常:

Exception in thread "main" 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, 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 connections to the port.".

当我在MS SQL的对象资源管理器中检查“属性”并点击“查看连接属性”时,我发现“服务器不可用”。这个问题可能和异常信息相关。

如何让服务器变为可用状态?

编辑:

我正在使用SQL Server 2008,并且我已经启用了TCP/IP,并重新启动了实例。但仍然显示“服务器不可用”。

还有其他的想法吗?


你的连接字符串是什么? - Oliver Hanappi
Oliver,我不知道连接字符串是什么。 - Eric Wilson
11个回答

0

连接 SQL Server 2014 时发现相同的错误。

我登录到 SQL Server 确保正确的端口号已设置。
对于我的情况,SQL 实例的端口号未设置。

因此,我从连接字符串 URL 中删除了端口号,然后就能够连接了。

任何遇到这个问题的人都可以尝试这种方法。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接