hjjof001
hjjof001
采纳率60%
2017-11-15 13:14

jdbc连接SQL server连不上

已采纳

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 127.0.0.1, port 1433 has failed. Error: Connection refused: connect. Please verify the connection properties and check that a SQL Server instance is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:130) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1195) at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(SQLServerConnection.java:1054) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:758) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:842) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at javaapplication3.JavaApplication3.JDBCon(JavaApplication3.java:27) at javaapplication3.JavaApplication3.main(JavaApplication3.java:18)图片

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

3条回答

  • dcxy0 Q544471255 4年前

    如果是工具可以连接到数据库而Java连接不了,可以参考:

    在服务(运行->services.msc)中,右键相关服务,打开属性,在登录选项卡,选择本地系统账户,之后重启服务.

    点赞 1 评论 复制链接分享
  • dcxy0 Q544471255 4年前

    你先用sql server的可视化工具连接一下,试试能不能连接,你这个错误是sql server服务没打开

    点赞 评论 复制链接分享
  • jianluguo jianluguo 4年前

    检查sql server 服务是否打开了

    点赞 评论 复制链接分享