I am new to Java programming, having a doubt on try with resources uses sharing the code
String statement= "<statement>";
DataSource ds = createDSConnection();
if (ds == null) return;
try (PreparedStatement prepare = ds.getConnection().prepareStatement(statement)) {
// statement values
prepare.execute();
} catch (Exception e) {
}
Will this close both PrepareStatement and as well as db.connection(), or will it just just close PreparedStatement only?