Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since the data source is managed by the application server (and WebSphere is a full featured implementation of Java EE), it's actually the JCA spec that applies here. Section 7.9 of the JCA 1.5 imposes the following restrictions on the ability of an application to change the transaction isolation level:</p> <blockquote> <p>If a connection is marked as shareable, it must be transparent to the application whether a single shared connection is used or not. The application must not make assumptions about a single shared connection being used, and hence must use the connection in a shareable manner.</p> <p>However, a J2EE application component that intends to use a connection in an unshareable way must leave a deployment hint to that effect, which will prevent the connection from being shared by the container. Examples of unshareable usage of a connection include changing the security attributes, isolation levels, character settings, and localization configuration.</p> </blockquote> <p>To summarize: in general, your application should not attempt to change the isolation level if the resource reference configures the connection as shareable. If you look at the <em>Requirements for setting data access isolation levels</em> topic in the WAS infocenter, you will also find the following statement:</p> <blockquote> <p>Trying to directly set the isolation level through the setTransactionIsolation() method on a shareable connection that runs in a global transaction is not allowed. To use a different isolation level on connections, you must provide a different resource reference.</p> </blockquote> <p>On the other hand, section 7.9.1 of the JCA 1.5 spec describes scenarios where an app server may still allow an application to change the isolation level, even if the connection is shareable. Basically this applies to scenarios where the connection is configured as shareable, but where it is effectively not shared (because there is no need to share the connection between multiple components).</p> <p>The <em>Extensions to data access APIs</em> topic in the infocenter suggests that WebSphere supports this:</p> <blockquote> <p>applications [...] cannot modify the properties of a shareable connection after making the connection request, if other handles exist for that connection. (If no other handles are associated with the connection, then the connection properties can be altered.)</p> </blockquote> <p>Therefore you should be able to use setTransactionIsolation() to change the isolation level in particular scenarios, but this depends on how your application uses the connection.</p> <p>Finally, you didn't describe in detail how you monitored that at the database level, but you need to take into account that at some point the app server needs to reset the isolation level on the physical connection. Therefore, if setTransactionIsolation() succeeds, the change may be in effect only for a short time on the physical connection.</p> <p>Note that there are a couple of ways to avoid all these complications (that may or may not be applicable in your case):</p> <ul> <li>Instead of using setTransactionIsolation(), configure the appropriate isolation level on the resource reference, and if necessary use multiple resource references.</li> <li>Use the WebSphere specific WSDataSource API to specify the expected isolation level before acquiring the connection.</li> <li>Modify your SQL to change the isolation level on a per query basis (e.g. use <code>WITH UR</code>).</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload