[
https://issues.apache.org/jira/browse/CAMEL-24045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18095838#comment-18095838
]
Federico Mariani commented on CAMEL-24045:
------------------------------------------
Pull request: https://github.com/apache/camel/pull/24656
_Claude Code on behalf of Federico Mariani_
> camel-sql - Connection leak with outputType=StreamList when the statement is
> not a query
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-24045
> URL: https://issues.apache.org/jira/browse/CAMEL-24045
> Project: Camel
> Issue Type: Bug
> Components: camel-sql
> Reporter: Federico Mariani
> Assignee: Federico Mariani
> Priority: Major
>
> SqlProducer.processStreamList() obtains a raw connection from the DataSource
> so it can stay open while the exchange is routed. When
> {{PreparedStatement.execute()}} returns false (INSERT/UPDATE/DELETE/DDL), the
> result-set branch is skipped: no {{ResultSetIteratorCompletion}} is
> registered and neither the connection nor the statement is ever closed (the
> catch block only closes on exception).
> The executed SQL can vary per exchange via the {{CamelSqlQuery}} header or
> {{useMessageBodyForSql=true}}, so each such exchange leaks one pooled
> connection, eventually exhausting the pool. Reproduced with a
> connection-counting DataSource: one connection remains open after the
> exchange completes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)