简体   繁体   English

我尝试连接到SQL Server 2014,但始终会出现错误,该如何解决

[英]I tried to connect to SQL Server 2014 but an error always occurs, how to solve it

Note: I included the mssql-jdbc-6.4.0.jre7 jar file 注意:我包含了mssql-jdbc-6.4.0.jre7 jar文件

The error: 错误:

W/System.err: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. W / System.err:com.microsoft.sqlserver.jdbc.SQLServerException:驱动程序无法通过使用安全套接字层(SSL)加密建立到SQL Server的安全连接。 Error: "Socket closed". 错误:“套接字已关闭”。 ClientConnectionId:0c66e1a1-9a3a-4554-9137-9868b305b033 ClientConnectionId:0c66e1a1-9a3a-4554-9137-9868b305b033

the source code: 源代码:

public void click (View view)
{
    new Thread(new Runnable(){
        @Override
        public void run()
        {
            try {
                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                Connection con;
                con = DriverManager.getConnection("jdbc:sqlserver://IP:port;databaseName=DB;user=user;password=password");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
}).start();
}

好像服务器不可用,现在,检查一下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM