Croway opened a new pull request, #24810:
URL: https://github.com/apache/camel/pull/24810

   Backport of #24656 to `camel-4.18.x`.
   
   JIRA: https://issues.apache.org/jira/browse/CAMEL-24045
   
   `SqlProducer.processStreamList()` takes a raw connection from the DataSource 
so the result set can stay open while the exchange is routed. When 
`PreparedStatement.execute()` returns `false` (INSERT/UPDATE/DELETE/DDL), the 
result-set branch was skipped: no `ResultSetIteratorCompletion` was registered 
and neither the connection nor the statement was ever closed — the catch block 
only cleaned up on exception. Since the executed SQL can vary per exchange via 
the `CamelSqlQuery` header or `useMessageBodyForSql=true`, each such exchange 
leaked one pooled connection, eventually exhausting the pool.
   
   Changes:
   - Close the statement and return the connection to the pool when the 
executed statement produced no result set
   - Set the `CamelSqlUpdateCount` header from `getUpdateCount()` for the 
non-query case, consistent with the non-query path in `processInternal()`
   - New test with a connection-counting DataSource proving no connection stays 
open after the exchange completes and asserting the update-count header
   - Adapted test import for `camel-4.18.x` (`junit5` package instead of 
`junit6`)
   
   _Claude Code on behalf of Croway_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to