I'm using the following code in a Thread:
try {
Class.forName("org.postgresql.Driver");
DriverManager.setLoginTimeout(60);
conexao = DriverManager.getConnection(url,usuario,senha);
}catch(Exception e){
mensagemErro = e.getMessage();
}
And on another Thread (from the GUI) has a window like cancel button, but I do not know how to cancel the DriverManager. connection is a public variable.