Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-17599

camel-jdbc - JdbcProducer leaks PreparedStatement

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.14.1, 3.15.0
    • 3.14.2, 3.16.0
    • camel-jdbc
    • None
    • Unknown

    Description

      Originally reported on the a Quarkus Zulip thread:

      https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Camel.20JDBC.20leaks.20statement

      There are 2 different execution paths in JdbcProducer. doCreateAndExecuteSqlStatementWithHeaders & doCreateAndExecuteSqlStatement.

      doCreateAndExecuteSqlStatementWithHeaders does close the PreparedStatement:

      https://github.com/apache/camel/blob/camel-3.14.1/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java#L185-L188

      doCreateAndExecuteSqlStatement does not:

      https://github.com/apache/camel/blob/camel-3.14.1/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java#L244-L246

      This PR & commit suggests auto-closing is perhaps not desirable:

      https://github.com/apache/camel/pull/6192

      The code prior to Camel 3.12.x did close the PreparedStatement in the finally block, so maybe that should be restored.

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              jamesnetherton James Netherton
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: