When should a java PreparedStatement be closed?

Viewed 14203

In the tutorial "Using Prepared Statements" it states that they should always be closed. Suppose I have a function

getPrice() {
}

that I expect to be called multiple times per second. Should this method be opening and closing the PreparedStatement with every single method call? This seems like a lot of overhead.

5 Answers
Related