Good morning,
I'm trying to create a connection of Android Virtual
created
in% with% with% with%. As my knowledge
in Eclipse ADT
I spent very little time trying to connect and did not have
success.
public String conectarDB() throws ExecutionException {
// Variáveis
try {
String driver = "com.postgresql.Driver";
String url = "jdbc:postgresql://127.0.0.1:5432/database";
String user = "postgres";
String pass = "#Servicedesk#@!1";
// Conectar
try {
Class.forName(driver);
Connection con = null;
con = (Connection) DriverManager.getConnection(url, user, pass);
return ("Conexão: Funcionando!");
} catch (ClassNotFoundException e) {
e.printStackTrace();
return ("Erro com Database!");
} catch (SQLException e) {
e.printStackTrace();
return ("Erro com JDBC!");
}
} catch(Exception e) {
e.printStackTrace();
return ("Conexão: Erro no envio de Conexão!");
}
}