【发布时间】:2010-11-08 09:01:44
【问题描述】:
我正在尝试从 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,并重新启动了我的实例。我仍然被告知“服务器不可用。”
还有其他想法吗?
【问题讨论】:
-
你的连接字符串是什么?
-
奥利弗,我不知道连接字符串是什么。
标签: java sql-server jdbc