Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 501349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:10:50+00:00 2026-05-13T06:10:50+00:00

I am currently retrieving both a UserTransaction and a DataSource from a Weblogic 10.3

  • 0

I am currently retrieving both a UserTransaction and a DataSource from a Weblogic 10.3 server using JNDI.

I have set the Datasource up to ‘Support Global Transactions’ and to use ‘Logging Last Resource’

My hope was that by beginning a UserTranscation and then retrieving a JDBC connection from the Datasource the connection would participate in the Transaction.

This does not appear to be the case, and my insert statements are being commited straight away and rolling back the transaction does not have any effect.

Are my above assumptions correct?

Can anyone point me in the direction of some documentation or samples on how to achieve this?

Many thanks in advance

UPDATE:

As requested here is a skeleton outline of the code I am using:

private void doSomething() {
Connection conn = null;
try {
    Hashtable env = new java.util.Hashtable();
    env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    env.put(javax.naming.Context.PROVIDER_URL,"t3://localhost:8080");
    InitialContext ctx = InitialContext(env));

    UserTransaction transaction = null;
    transaction = (UserTransaction) ctx.lookup("java:comp/UserTransaction");

    DataSource dataSource = (DataSource) context.lookup("jdbc/xxxxx/DataSource");
    conn = dataSource.getConnection();
    transaction.begin();
    // JDBC code goes here
    transaction.commit();
} catch(Exception e) {
    // TODO
    if (transaction != null) {
    try {
    transaction.rollback();
    } catch (Exception ex) {
    // TODO
    }
} finally {
  if (con != null) {
    conn.close
  }
}
}

UPDATE 2:

In order to resolve this issue I had to do 2 things:

  1. Change the order of the code to firstly begin the user transaction and then get a connection from the Datastore (as pointed out by Pascal Thivent).

  2. Change the Datasource referenced by ‘”jdbc/xxxxx/DataSource”‘ to an XADatasource. This is because I was calling code inside the user transaction that used another Datasource that was already configured to support LLR and as pointed out by Pascal Thivent below you can only have one LLR Datasource participate in a transcation.

I have accepted Pascal Thivent’s answer below because it explained both of these issues.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:10:51+00:00Added an answer on May 13, 2026 at 6:10 am

    Yes, your assumptions are correct and, according to Create LLR-enabled JDBC data sources, your data source seems properly configured.

    Do you get the connection after starting the user transaction? Can you show your code or pseudo code?

    UPDATE: As mentioned in Programming Considerations and Limitations for LLR Data Sources:

    • When programming with an LLR data source, you must start the global transaction before calling getConnection on the LLR data source. If you call getConnection before starting the global transaction, all operations on the connection will be made outside of the global transaction.

    So, could you try this:

    transaction.begin(); //start the global tx before calling getConnection()
    conn = dataSource.getConnection(); 
    ...
    transaction.commit();
    

    UPDATE2: Not sure to understand from where the 2nd connection is comming (your pseudo code isn’t showing this). However, according to the same Programming Considerations and Limitations for LLR Data Sources:

    • Only instances of a single LLR data source may participate in a particular transaction. A single LLR data source may have instances on multiple WebLogic servers, and two data sources are considered to be the same if they have the same configured name. If more than one LLR data source instance is detected and they are not instances of the same data source, the transaction manager will roll back the transaction.

    Actually, without a fully representative example, I feel a bit like walking in the dark 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently captureStillImageAsynchronouslyFromConnection returns an image at 640x480 pixels from a AVCaptureSession of AVCaptureSessionPreset640x480 .
Currently within my application I have a setup where upon submission of data, PHP
Currently, i'm sorting a list using LINQ to objects, then doing a ToList() on
In our application we have an object that receives attributes at runtime. For example,
In the below code I am updating IndexOrder by Id using TryUpdateModel. Below update
I know that the original css value from the style sheet can be assigned
I have an AJAX-enabled WCF service with the following signature: [OperationContract] [WebGet] public JQGridContract
Currently I am trying to embed a Java applet onto a webpage, and the
I'm trying to send an archived objective-c object to a php script and then
I am working on an application that moves windows of third party applications around

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.