Is it safe to do connection.createStatement().executeQuery(String query);
, or should each java.sql.Statement
object be created and closed by "hand" on every use, even if the connection is closed in a finally block?
If multiple queries are executed in one method by one connection it would use much less code if instantiating and closing each statement wasn't strictly necessary.