2011-03-07 33 views
2

我能够使用SQL Server Management Studio连接到本地计算机上的MSSQL 2008 express,主机为'nash-pc \ sqlexpress'。但是,当我连接到Microsoft JDBC驱动程序,它给了我像下面的错误。 JDBC在主机名中有'\'有问题?我不知道如何让主机名变成'localhost'而不是'nash-pc \ sqlexpress'。有趣的是,如果我使用服务器名称作为'localhost',那么我甚至无法连接到SQL Server Management Studio。无法使用JDBC连接到msql 2008 Express

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

+0

是否启用远程连接 – 2011-03-07 04:18:44

回答