Do I need to close 'PreparedStatement'?
Yes, you must close it. If the connection from a pool, closing it actually sends it back to the pool for reuse.
Close in the finally{}
block, such that if an exception is thrown, you still get the chance to close this.
Yes, you have to close the prepared statements (PreparedStatement
Object) and result sets as they may cause memory leakage.
For more information, see Using Prepared Statements.