# Explicitly closing Statements, ResultSets, and Connections

You should explicitly close Statements, `ResultSets,` and `Connections` when you no longer need them.

Connections to Derby are resources external to an application, and the garbage collector will not close them automatically.

For example, close a Statement object using its `close` method; close a `Connection` object using its `close` method. If auto-commit is disabled, active transactions need to be explicitly committed or rolled back before closing the connection

Parent topic: Transactions
Related concepts
Transactions when auto-commit is disabled
Using auto-commit
Statement versus transaction runtime rollback
Related tasks
Turning off auto-commit