【发布时间】:2011-03-07 04:16:44
【问题描述】:
我能够使用主机“nash-pc\sqlexpress”的 SQL Server Management Studio 连接到本地计算机上的 MSSQL 2008 express。但是当我与 Microsoft JDBC 驱动程序连接时,它给了我如下错误。 JDBC 在主机名中有“\”有问题吗?我不确定如何使主机名成为“localhost”而不是“nash-pc\sqlexpress”。有趣的是,如果我使用服务器名称作为“localhost”,那么我什至无法连接 SQL Server Management Studio。
“The driver encountered an unknown error: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host nash-pc, 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.”。”
我的 JDBC 连接字符串
司机:com.microsoft.sqlserver.jdbc.SQLServerDriver
网址:jdbc:sqlserver://nash-pc\sqlexpress:1433;databaseName=jruby
【问题讨论】:
-
你开启远程连接了吗?
标签: sql sql-server-2008 jdbc