View RSS Feed

Java Database

  1. Closing Connections

    by , 03-10-2012 at 08:43 AM
    Method Statement.close shall always be called to release resources instantly that are in use when usage of a statement gets finished. To close ResultSet object, call Statement.close method.

    For closing all resources or release the memory present in Java program, finally block is used.

    Given piece of code details how a statement is closed in the finally block present in your program.
    Java Code:
    } finally {
        if (stmt != null) { stmt.close(); }