The following must be considered when using the
Statementinstance as many times as you want. You could create one as soon as you open the connection and use it for the connection's lifetime. But you have to remember that only one
ResultSetcan exist per
PreparedStatementat a given time.
ResultSet, you can simply create and use another
Statementfor each thread. Refer to Chapter 10, Using the Driver in a Multithreaded or a Servlet Environment if you are thinking of using threads, as it covers some important points.
PreparedStatementyou should close it.