Click here to Skip to main content
15,867,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
cannot establish a connection to jdbc:sqlserver://localhost:1433;databaseName=TestSys using com.microsoft.sqlserver.jdbc.SQLServerDriver (The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".)

anyone can help me ?
Posted

1 solution

confirm you are connecting to the sql server using the proper name & instance name (i.e. if it's not the "default" instance, you will need to use the instance name).

since i see you are using localhost as your server name, perhaps you have a sqlExpress instance? by default, this runs under the instance name "sqlexpress" so the server may be like "localhost\sqlexpress".

finally, you may need to open sql configuration manager and enable tcp/ip protocol for the instance you are trying to connect to. even though it's local, it seems to be using tcp/ip to do the connection. again, by default sqlexpress sets this to disabled.

again, this is assuming sqlexpress.
 
Share this answer
 
Comments
Member 11504333 26-Mar-15 4:40am    
i am using instance name as sqlexpress or my database name but its showing the same error cannot establish a connection to jdbc:sqlserver://localhost\sqlexpress:1433;databaseName=TestSys using com.microsoft.sqlserver.jdbc.SQLServerDriver (The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".)
jchoponis 6-Apr-15 16:26pm    
sorry - just saw this comment -> can you confirm you allow tcp connections for sql to this server (i.e. localhost\sqlexpress) -> can you connect just using sql management studio from the local machine to you db instance (let's make sure you can connect at all)?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900