无法使用JDBC连接到sql 2008 express

时间:2011-03-07 04:16:44

标签: sql sql-server-2008 jdbc

我能够使用SQL server management Studio连接到本地计算机上的MSSQL 2008 express,用于主机'nash-pc \ sqlexpress'。但是当我连接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

url:jdbc:sqlserver://nash-pc\sqlexpress:1433;databaseName=jruby

相关问题