无法使用JDBC连接到msql 2008 express

amj*_*amj 2 sql jdbc sql-server-2008

我能够使用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

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