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

后端 未结 3 1004
天涯浪人
天涯浪人 2021-01-11 10:50

I\'m having problems connecting to SQL databases. Whenever I try to connect to a SQL server I get the following error;

Caused by: org.hibernate.exception.JDB         


        
相关标签:
3条回答
  • 2021-01-11 11:40

    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>"
    0 讨论(0)
  • 2021-01-11 11:45

    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;
    
    0 讨论(0)
  • 2021-01-11 11:56

    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.

    0 讨论(0)
提交回复
热议问题