Java Reference
In-Depth Information
transactionIsolationToString ( txisolation ) + ")." );
conn . close ();
System . out . println ( "All done!" );
} catch
catch ( SQLException ex ) {
System . out . println ( "Database access failed:" );
System . out . println ( ex );
}
}
/** Convert a TransactionIsolation int (defined in java.sql.Connection)
* to the corresponding printable string.
*
* XXX Remove from here once darwinsys.jar gets committed.
*/
public
public static
static String transactionIsolationToString ( int
int txisolation ) {
switch
switch ( txisolation ) {
case
case Connection . TRANSACTION_NONE :
// transactions not supported.
return
return "TRANSACTION_NONE" ;
case
case Connection . TRANSACTION_READ_UNCOMMITTED :
// All three phenomena can occur
return
return "TRANSACTION_NONE" ;
case
case Connection . TRANSACTION_READ_COMMITTED :
// Dirty reads are prevented; non-repeatable reads and
// phantom reads can occur.
return
return "TRANSACTION_READ_COMMITTED" ;
case
case Connection . TRANSACTION_REPEATABLE_READ :
// Dirty reads and non-repeatable reads are prevented;
// phantom reads can occur.
return
return "TRANSACTION_REPEATABLE_READ" ;
case
case Connection . TRANSACTION_SERIALIZABLE :
// All three phenomena prvented; slowest!
return
return "TRANSACTION_SERIALIZABLE" ;
default
default :
throw
throw new
new IllegalArgumentException (
txisolation + " not a valid TX_ISOLATION" );
}
}
}
When you run it, in addition to some debugging information, you'll see something like this.
The details, of course, depend on your database:
Search WWH ::




Custom Search