Datasource connection and JTA tx - Weblogic

This is a discussion on Datasource connection and JTA tx - Weblogic ; Hello - We are having problems with JDBC connection interactions with JTA transactions. I understand that the datasource connection retrieved within a JTA transaction will become unavailable when the tx is commited/rolledback. So, I've been trying to perform operations in ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Datasource connection and JTA tx

  1. Datasource connection and JTA tx


    Hello -
    We are having problems with JDBC connection interactions with JTA transactions.

    I understand that the datasource connection retrieved within a JTA transaction
    will become unavailable when the tx is commited/rolledback.

    So, I've been trying to perform operations in this order:
    - retrieve a datasource connection (conn1)
    - init a JTA transaction (within an EJB etc) which fetches a datasource connection
    - commit the transaction
    - perform some operation using conn1
    -> results in SQLException "The transaction is no longer active - status: 'Committed'.
    No further JDBC access is allowed within this transaction."

    So, my question is: without using a separate connection pool, is it possible to
    implement this type of workflow?

    Background: We need this to implement some "lazy loading" functionality whereby
    a connection is used to fetch some partially initialized data, some transactions
    are performed, then the partially initialized data relies on its connection to
    lazily populate as needed.

    Any advice is appreciated.

    Thanks
    tyson

  2. Re: Datasource connection and JTA tx



    Tyson Norris wrote:

    > Hello -
    > We are having problems with JDBC connection interactions with JTA transactions.
    >
    > I understand that the datasource connection retrieved within a JTA transaction
    > will become unavailable when the tx is commited/rolledback.
    >
    > So, I've been trying to perform operations in this order:
    > - retrieve a datasource connection (conn1)
    > - init a JTA transaction (within an EJB etc) which fetches a datasource connection
    > - commit the transaction
    > - perform some operation using conn1
    > -> results in SQLException "The transaction is no longer active - status: 'Committed'.
    > No further JDBC access is allowed within this transaction."
    >
    > So, my question is: without using a separate connection pool, is it possible to
    > implement this type of workflow?


    If you want to do jdbc outside the scope of a transaction, you should get the connection
    from a non-transactional DataSource. You should be able to create more than one DataSource
    for a single pool, but if not, you could (as you suggest) make another pool to the same
    DBMS or other DBMS.

    >
    > Background: We need this to implement some "lazy loading" functionality whereby
    > a connection is used to fetch some partially initialized data, some transactions
    > are performed, then the partially initialized data relies on its connection to
    > lazily populate as needed.
    >
    > Any advice is appreciated.
    >
    > Thanks
    > tyson



+ Reply to Thread