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

JdbcProducer should rather use spring's DataSourceUtils.getConnection(ds) when in transacted() block

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 2.14.1
    • None
    • camel-jdbc
    • None
    • Unknown

    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).

      Attachments

        Activity

          People

            Unassigned Unassigned
            ggrzybek Grzegorz Grzybek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: