简体   繁体   中英

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

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. Error: "Socket closed". 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();
}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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