amj
amj

Reputation: 436

Cannot connect to msql 2008 express with JDBC

I was able to connect to MSSQL 2008 express on local machine using SQL server management Studio for host 'nash-pc\sqlexpress'. But when I connect with Microsoft JDBC driver it gives me error like below. JDBC has problem with having '\' in the host name? I'm not sure how to make host name to become 'localhost' instead of 'nash-pc\sqlexpress'. funny thing is that if i use server name as 'localhost' then I could not even connect with 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."."

My JDBC connection string

Driver: com.microsoft.sqlserver.jdbc.SQLServerDriver

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

Upvotes: 2

Views: 10193

Answers (1)

Related Questions