Consultor Eletrônico



Kbase 20722: How to Set Transaction Isolation Level from Java
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   6/25/2010
Status: Verified

GOAL:

How to set the transaction isolation level from Java

GOAL:

What is the JAVA syntax for setting the Transaction Isolation Level of a connection object?

GOAL:

How to configure my JDBC application to a specific isolation level

GOAL:

Is there a parameter to set isolation level at the connection for JDBC clients

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
OpenEdge Category: SQL

FIX:

For ODBC or JDBC applications, isolation levels specify the degree to which one transaction can modify data or database objects which are being used by a concurrent transaction.

For JDBC applications, the isolation level is set at the java.sql.Connection level.

Currently, there is no syntax in the SQL-92 specification for setting the transaction isolation level.


JDBC connection parameters
When connecting to an OpenEdge database using the JDBC driver, You Can Specify two optional
connection parameters:
?{ ?n defaultSchema - The schema to Be Used During processing statement
?{ ?n statementCacheSize - The Number of entries In the statement cache
Here is an example of how to Specify These connection parameters:

jdbc: DataDirect: OpenEdge / / myhost: 6718; databaseName = sports2000; defaultSchema
= Schema1; statementCacheSize = 10;

So, these are the only optional parameters that can be used during the connection.To set the transaction isolation level from a JAVA program, use the "setTransactionIsolation()" method of the "java.sql.Connection" class.

For example, the following code snippet sets the Transaction Isolation Level to READ COMMITED.

import java.sql.*;

...

try
{
sqlConnSession = (Connection) testLwPool.getConn();
sqlConnSession.setTransactionIsolation(
Connection.TRANSACTION_READ_COMMITTED);
}
catch( SQLException ex )
{
...
}