You must do these things in your method.
1. Use a local variable for your Connection.
2. Ensure that your
JDBC objects are closed in the finally block.
3. Handle each close by closing the ResultSet, Statement and Connection in their own try/catch block.