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();
}