The driver could not establish a secure connection to SQL Server by using SSL

百般思念 提交于 2019-12-01 03:13:48

I suspect that when your laptop is on a "different network" that it is then inside the firewall that is also protecting the database servers you are connecting to. Hence, there is no problem making the database connections for this case.

Your "network at home" I presume is outside of the firewall protecting the database servers that you are trying to connect to. Hence, your database connection attempts for this case are being ignored due to the firewall protection.

If these assumptions are correct, you will need to contact the network administrator of the "different network" to gain access through the firewall from your home network.

I hope this helps.

Your problem is similar to https://youtrack.jetbrains.com/issue/IDEA-163324

The solution is:

  • open terminal
  • run scutil --getHostName
  • if hostname is not set or contains .local, run sudo scutil --set HostName "<YOUR HOSTNAME HERE>"
Sunil Kumar

Please make your string url like below and add sqljdbc42.jar in your project

url = "jdbc:sqlserver://" +serverName + ":1433;DatabaseName=" + dbName +";

encrypt = true;

trustServerCertificate=true;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!