[
https://issues.apache.org/jira/browse/CAMEL-8285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Grzegorz Grzybek updated CAMEL-8285:
------------------------------------
Description:
JdbcProducer gets {{java.sql.Connection}} by direct call to
{{javax.sql.DataSource#getConnection()}}. But depending on dataSource used, the
acquired connection may not be the correct JDBC connection (and XAResource in
case of XA transactions) which is currently associated with
{{org.springframework.transaction.PlatformTransactionManager}} used by
{{org.springframework.transaction.support.TransactionTemplate}} which is used
by Camel's {{<transacted>}}
({{org.apache.camel.spring.spi.TransactionErrorHandler}}).
JdbcProducer might use:
* org.springframework.jdbc.datasource.DataSourceUtils#getConnection()
* org.springframework.jdbc.datasource.DataSourceUtils#releaseConnection()
just like Spring's {{JdbcTemplate}} does it (and camel-sql component uses).
was:JdbcProducer gets {{java.sql.Connection}} by direct call to
{{javax.sql.DataSource#getConnection()}}. But depending on dataSource used, the
acquired connection may not be the correct JDBC connection (and XAResource in
case of XA transactions) which is currently associated with
{{org.springframework.transaction.PlatformTransactionManager}} used by
{{org.springframework.transaction.support.TransactionTemplate}} which is used
by Camel's {{<transacted>}}
({{org.apache.camel.spring.spi.TransactionErrorHandler}}).
> JdbcProducer should rather use spring's DataSourceUtils.getConnection(ds)
> when in transacted() block
> ----------------------------------------------------------------------------------------------------
>
> Key: CAMEL-8285
> URL: https://issues.apache.org/jira/browse/CAMEL-8285
> Project: Camel
> Issue Type: Improvement
> Components: camel-jdbc
> Affects Versions: 2.14.1
> Reporter: Grzegorz Grzybek
> Priority: Minor
>
> JdbcProducer gets {{java.sql.Connection}} by direct call to
> {{javax.sql.DataSource#getConnection()}}. But depending on dataSource used,
> the acquired connection may not be the correct JDBC connection (and
> XAResource in case of XA transactions) which is currently associated with
> {{org.springframework.transaction.PlatformTransactionManager}} used by
> {{org.springframework.transaction.support.TransactionTemplate}} which is used
> by Camel's {{<transacted>}}
> ({{org.apache.camel.spring.spi.TransactionErrorHandler}}).
> JdbcProducer might use:
> * org.springframework.jdbc.datasource.DataSourceUtils#getConnection()
> * org.springframework.jdbc.datasource.DataSourceUtils#releaseConnection()
> just like Spring's {{JdbcTemplate}} does it (and camel-sql component uses).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)