Is it safe to use connection.createStatement().executeQuery(String query);?
Posted
by javanix
on Stack Overflow
See other posts from Stack Overflow
or by javanix
Published on 2010-05-10T21:41:41Z
Indexed on
2010/05/10
21:44 UTC
Read the original article
Hit count: 241
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.
© Stack Overflow or respective owner