简体   繁体   中英

connecting to sql server with jdbc error

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

尝试10.0.0.2确保基本内容,例如数据库密码,名称,表名称.....

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM