Olá:
O que seria mais correto? Fazer assim:
ResultSet rs = null;
try {
rs = connection..createStatement().executeQuery(query);
// Uso o ResultSet
} catch (SQLException SQLEx) {
// Trato a Exceceao
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException SQLEx) {}
}
}
Ou:
Statement stmt = null;
ResultSet rs = null;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(query);
// Uso o ResultSet
} catch (SQLException SQLEx) {
// Trato a Excecao
} finally {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException SQLEx) {}
}
if (rs != null) {
try {
rs.close();
} catch (SQLException SQLEx) {}
}
}
Qual seriao motivo para a resposta?
Grato,

