0

I'm trying to connect to a sql server via the jdbc driver but keep getting this error:

Error connecting to the specified data source: 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.".

My connection string is this:

jdbc:sqlserver://localhost\SRVR_SQL:1433;DatabaseName=spotfire_server    

I've also tried this:

jdbc:sqlserver://10.10.60.12\SRVR_SQL:1433;DatabaseName=spotfire_server    

and this:

jdbc:sqlserver://localhost:1433;DatabaseName=spotfire_server   

and this:

jdbc:sqlserver://SRVR_SQL:1433;DatabaseName=spotfire_server   

but all of them give the same error

gofr1
  • 15,741
  • 11
  • 42
  • 52
lightweight
  • 3,227
  • 14
  • 79
  • 142
  • possible duplicate of [JDBC connection failed, error: TCP/IP connection to host failed](http://stackoverflow.com/questions/18841744/jdbc-connection-failed-error-tcp-ip-connection-to-host-failed) – duffymo Dec 14 '13 at 15:16

2 Answers2

0

try 10.0.0.2 make sure of the basic things like database password, name , table name.....

new_jerry
  • 21
  • 1
  • 6
0

Read the error:

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.

Are you sure SQL Server is running locally? Can you connect to it via SQL Server Admin tools?

Which JDBC driver are you using - Microsoft or jDTS?

Try this URL, assuming the listener is running on 10.10.60.12, the port is 1433, and the schema name is dbName:

jdbc:sqlserver://10.10.60.12:1433;DatabaseName=dbName
duffymo
  • 305,152
  • 44
  • 369
  • 561
  • I can connect to it via SSMS and I'm using microsoft JDBC drivers...I tried what you mentioned above but still get the same error – lightweight Dec 14 '13 at 14:33