Error:The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect

最后都变了- 提交于 2019-11-29 02:43:07

I followed the steps below to successfully connect to an SQLExpress instance using JDBC:

  1. Configure TCP/IP communication with SQL Express
    1. Open SQL Server Configuration Manager.
    2. Go to SQL Server Network Configuration -> Protocols for SQLEXPRESS
    3. Set the status of TCP/IP protocol to "Enabled" (if it is already not).
    4. Open Properties window for TCP/IP, go to IP Addresses section.
    5. Go to the bottom of this property page and set the TCP Port under IPAll to 1433.
  2. Connect to the SQLExpress instance using Microsoft's JDBC driver for SQL Server
    1. JDBC URL: jdbc:sqlserver://localhost;instance=SQLEXPRESS;databaseName=<your DB>;user=<your User>;password=<your Passwd>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!