To avoid resource leaks and ensure efficient resource usage.
JDBC resources such as Connection, Statement, and ResultSet should be closed explicitly to release database and system resources. Failing to close these resources can lead to memory leaks and database connection exhaustion. In a scenario where an e-commerce application handles numerous database queries per minute, not closing resources can lead to performance degradation or application failure.
Additional Notes
Why is it important to close JDBC resources explicitly?