ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzatz_5.4.0.1/51/program/dataisol.htm

34 lines
3.5 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>Isolation level and resource reference</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h6><a name="dataisol"></a>Isolation level and resource reference</h6>
<!--<p>In a J2EE 1.2 module, you can specify the isolation level at an enterprise bean method level, bean level, or module level. This capability has been removed from the J2EE 1.3 module. WebSphere Application Server Version 5.0 is compliant with the J2EE 1.3 specification; therefore you cannot specify isolation level on the EJB method level or bean level. Also, if a JDBC application, a bean-managed persistence (BMP) bean, or a servlet runs in a global transaction, and you are using shareable connections, you cannot set the isolation level on a connection.</p>
<p>When a container-managed persistence (CMP) bean uses a new data source to access a back end database, the isolation level is determined by the WebSphere Application Server run time based on the type of access intent that this method or the bean has chosen. All other connection users can also use the access intent and application profile support to manage their concurrency control.</p> -->
<p>For all JDBC connections (excluding those used by CMP beans), you can specify an isolation level default on the resource reference. For shareable connections that run in global transactions, this default is the only way to set the isolationLevel for connections. 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>
<p>Each resource reference associates with one isolation level. When your application uses this resource reference Java Naming and Directory Interface (JNDI) name to look up a data source, every connection returned from this data source using this resource reference has the same isolation level.</p>
<p>Components needing to use shareable connections with multiple isolation levels can create multiple resource references, giving them different JNDI names, and have their code look up the appropriate data source for the isolation level they need. In this way, you use separate connections with the different isolation levels enabled on them.</p>
<p>It is possible to map these multiple resource references to the same configured data source. The connections still come from the same underlying pool, however, the connection manager does not allow sharing of connections requested by resource references with different isolation levels.</p>
<p>For example, a data source is bound to two resource references: jdbc/RRResRef and jdbc/RCResRef. RRResRef has the RepeatableRead isolation level defined . RCResRef has the ReadCommitted isolation level defined. If your application wants to update the tables or a BMP bean updates some attributes, it can use the jdbc/RRResRef JNDI name to look up the data source instance. All connections returned from the data source instance have a RepeatableRead isolation level. If the application wants to perform a query for read only, then it is better to use the jdbc/RCResRef JNDI name to look up the data source.</p>
</body>
</html>