com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host DESKTOP-J58GNR6, port 1433 has failed. Error: “null. Verify the connection properties. Make sure that an instance of SQL Server is
SQL Server本地数据库的数据源无法获取Schema。
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.”
DESKTOP-J58GNR6 应该是你安装 SQLserver 主机的主机名。把它修改成你的主机的 IP 地址。
因为 DataEase 需要通过 IP 地址来链接你的 SQLserver 服务器,通常我们会把主机名添加到 DNS 服务器中,这样在请求时可以通过 DNS 服务器将主机名解析为 IP 地址。我猜测你没有 DNS 服务器,所以需要填写 IP 地址,并且需要在主机上关闭防火墙或者放开 1433 端口。
我换成了ip地址,但还是报错。
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 192.168.56.1, port 1433 has failed. Error: “Connection refused (Connection refused). 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.”.