View RSS Feed

Java Database

Closing Connections

Rate this Entry
by , 03-10-2012 at 08:43 AM (586 Views)
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(); }
}
SQLException is thrown by JDBC when an error is encountered while an interaction takes place with a data source.

Submit "Closing Connections" to Facebook Submit "Closing Connections" to Digg Submit "Closing Connections" to del.icio.us Submit "Closing Connections" to StumbleUpon Submit "Closing Connections" to Google

Categories
JDBC

Comments