Updated on 2026-07-28 GMT+08:00

Closing a Database Connection

After completing required data operations in a database through a database connection, call the close() method to close the database connection.

conn.close();

The Connection, Statement, and ResultSet APIs all provide a close() method, which should be used to close objects after use.