- Is it necessary to close connection and statement when method terminates?
- void databaseCall() {
- Connection con = null;
- Statement statement = null
- try {
- con = getConnection(...);
- statement = con.createStatement(...);
- // do some query
- } catch (SQLException e) {
- // bla bla
- } finally {
- try {con.close();} catch (Exception e1) {}
- try {statement.close();} catch (Exception e1) {}
- }
- }