Skip to content

Try-with-Resources Not Closing Database Connections for One Select Query #2213

Open
@baliyanshilpa04

Description

Facing an issue with try-with-resources as it is not closing the database connections automatically particularly for one select query while working for other queries of the same class within a java application. Please suggest what could be the issue here.
Steps to Reproduce
Execute the problematic select query using the try-with-resources statement.
Monitor the database connections to observe that the connection is not closed.
Execute other queries in the same class to confirm that their connections are closed properly.
Expected Behavior
The database connection should be automatically closed after the try-with-resources block for all queries.

Actual Behavior
The database connection remains open for one specific select query, causing potential resource leaks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions