Java Code Examples for java.sql.Connection#TRANSACTION_READ_UNCOMMITTED
The following examples show how to use
java.sql.Connection#TRANSACTION_READ_UNCOMMITTED .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gemfirexd-oss File: QueryPerfPrms.java License: Apache License 2.0 | 6 votes |
public static String getTxIsolation(int n) { switch (n) { case TRANSACTION_NONE: return "none"; case Connection.TRANSACTION_READ_UNCOMMITTED: return "transaction_read_uncommitted"; case Connection.TRANSACTION_READ_COMMITTED: return "transaction_read_committed"; case Connection.TRANSACTION_REPEATABLE_READ: return "transaction_repeatable_read"; case Connection.TRANSACTION_SERIALIZABLE: return "transaction_serializable"; default: String s = "Unknown transaction isolation level: " + n; throw new QueryPerfException(s); } }
Example 2
Source Project: gemfirexd-oss File: Converters.java License: Apache License 2.0 | 6 votes |
public static byte getThriftTransactionIsolation(int jdbcIsolationLevel) { switch (jdbcIsolationLevel) { case Connection.TRANSACTION_NONE: return gfxdConstants.TRANSACTION_NONE; case Connection.TRANSACTION_READ_UNCOMMITTED: return gfxdConstants.TRANSACTION_READ_UNCOMMITTED; case Connection.TRANSACTION_READ_COMMITTED: return gfxdConstants.TRANSACTION_READ_COMMITTED; case Connection.TRANSACTION_REPEATABLE_READ: return gfxdConstants.TRANSACTION_REPEATABLE_READ; case Connection.TRANSACTION_SERIALIZABLE: return gfxdConstants.TRANSACTION_SERIALIZABLE; default: return gfxdConstants.TRANSACTION_NO_CHANGE; } }
Example 3
Source Project: jaybird File: FBTpbMapper.java License: GNU Lesser General Public License v2.1 | 6 votes |
/** * Convert transaction isolation level name into a corresponding constant. * * @param isolationName * name of the transaction isolation. * @return corresponding constant. */ public static int getTransactionIsolationLevel(String isolationName) { switch (isolationName) { case TRANSACTION_NONE: return Connection.TRANSACTION_NONE; case TRANSACTION_READ_UNCOMMITTED: return Connection.TRANSACTION_READ_UNCOMMITTED; case TRANSACTION_READ_COMMITTED: return Connection.TRANSACTION_READ_COMMITTED; case TRANSACTION_REPEATABLE_READ: return Connection.TRANSACTION_REPEATABLE_READ; case TRANSACTION_SERIALIZABLE: return Connection.TRANSACTION_SERIALIZABLE; default: throw new IllegalArgumentException("Invalid isolation name."); } }
Example 4
Source Project: aceql-http File: TransactionUtil.java License: GNU Lesser General Public License v2.1 | 6 votes |
private static String getTransactionIsolationAsString( int transactionIsolationLevel) { if (transactionIsolationLevel == Connection.TRANSACTION_NONE) { return HttpParameter.NONE; } else if (transactionIsolationLevel == Connection.TRANSACTION_READ_UNCOMMITTED) { return HttpParameter.READ_UNCOMMITTED; } else if (transactionIsolationLevel == Connection.TRANSACTION_READ_COMMITTED) { return HttpParameter.READ_COMMITTED; } else if (transactionIsolationLevel == Connection.TRANSACTION_REPEATABLE_READ) { return HttpParameter.REPEATABLE_READ; } else if (transactionIsolationLevel == Connection.TRANSACTION_SERIALIZABLE) { return HttpParameter.SERIALIZABLE; } else { return "UNKNOWN"; } }
Example 5
Source Project: gemfirexd-oss File: GFXDPrms.java License: Apache License 2.0 | 6 votes |
private static int getTxIsolation(Long key, String val) { if (val.equalsIgnoreCase("none")) { return TRANSACTION_NONE; } else { if (val.equalsIgnoreCase("read_uncommitted") || val.equalsIgnoreCase("readUncommitted")) { return Connection.TRANSACTION_READ_UNCOMMITTED; } else if (val.equalsIgnoreCase("read_committed") || val.equalsIgnoreCase("readCommitted")) { return Connection.TRANSACTION_READ_COMMITTED; } else if (val.equalsIgnoreCase("repeatable_read") || val.equalsIgnoreCase("repeatableRead")) { return Connection.TRANSACTION_REPEATABLE_READ; } else if (val.equalsIgnoreCase("serializable")) { return Connection.TRANSACTION_SERIALIZABLE; } else { String s = "Illegal value for " + BasePrms.nameForKey(key) + ": " + val; throw new HydraConfigException(s); } } }
Example 6
Source Project: high-performance-java-persistence File: ACIDReadModifyWriteDefaultIsolationLevelTest.java License: Apache License 2.0 | 6 votes |
private void printIsolationLevel(Connection connection) throws SQLException { int isolationLevelIntegerValue = connection.getTransactionIsolation(); String isolationLevelStringValue = null; switch (isolationLevelIntegerValue) { case Connection.TRANSACTION_READ_UNCOMMITTED: isolationLevelStringValue = "READ_UNCOMMITTE"; break; case Connection.TRANSACTION_READ_COMMITTED: isolationLevelStringValue = "READ_COMMITTED"; break; case Connection.TRANSACTION_REPEATABLE_READ: isolationLevelStringValue = "REPEATABLE_READ"; break; case Connection.TRANSACTION_SERIALIZABLE: isolationLevelStringValue = "SERIALIZABLE"; break; } LOGGER.info("Transaction isolation level: {}", isolationLevelStringValue); }
Example 7
Source Project: gemfirexd-oss File: Converters.java License: Apache License 2.0 | 6 votes |
public static byte getThriftTransactionIsolation(int jdbcIsolationLevel) { switch (jdbcIsolationLevel) { case Connection.TRANSACTION_NONE: return gfxdConstants.TRANSACTION_NONE; case Connection.TRANSACTION_READ_UNCOMMITTED: return gfxdConstants.TRANSACTION_READ_UNCOMMITTED; case Connection.TRANSACTION_READ_COMMITTED: return gfxdConstants.TRANSACTION_READ_COMMITTED; case Connection.TRANSACTION_REPEATABLE_READ: return gfxdConstants.TRANSACTION_REPEATABLE_READ; case Connection.TRANSACTION_SERIALIZABLE: return gfxdConstants.TRANSACTION_SERIALIZABLE; default: return gfxdConstants.TRANSACTION_NO_CHANGE; } }
Example 8
Source Project: gemfirexd-oss File: GFXDPrms.java License: Apache License 2.0 | 6 votes |
public static String getTxIsolation(int n) { switch (n) { case TRANSACTION_NONE: return "none"; case Connection.TRANSACTION_READ_UNCOMMITTED: return "read_uncommitted"; case Connection.TRANSACTION_READ_COMMITTED: return "read_committed"; case Connection.TRANSACTION_REPEATABLE_READ: return "repeatable_read"; case Connection.TRANSACTION_SERIALIZABLE: return "serializable"; default: String s = "Unknown transaction isolation level: " + n; throw new HydraConfigException(s); } }
Example 9
Source Project: Tomcat8-Source-Read File: InstanceKeyDataSource.java License: MIT License | 5 votes |
/** * Sets the value of defaultTransactionIsolation, which defines the state of connections handed out from this pool. * The value can be changed on the Connection using Connection.setTransactionIsolation(int). The default is JDBC * driver dependent. * * @param v * Value to assign to defaultTransactionIsolation */ public void setDefaultTransactionIsolation(final int v) { assertInitializationAllowed(); switch (v) { case Connection.TRANSACTION_NONE: case Connection.TRANSACTION_READ_COMMITTED: case Connection.TRANSACTION_READ_UNCOMMITTED: case Connection.TRANSACTION_REPEATABLE_READ: case Connection.TRANSACTION_SERIALIZABLE: break; default: throw new IllegalArgumentException(BAD_TRANSACTION_ISOLATION); } this.defaultTransactionIsolation = v; }
Example 10
Source Project: hottub File: CommonRowSetTests.java License: GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "rowSetIsolationTypes") protected Object[][] rowSetIsolationTypes() throws Exception { RowSet rs = newInstance(); return new Object[][]{ {rs, Connection.TRANSACTION_NONE}, {rs, Connection.TRANSACTION_READ_COMMITTED}, {rs, Connection.TRANSACTION_READ_UNCOMMITTED}, {rs, Connection.TRANSACTION_REPEATABLE_READ}, {rs, Connection.TRANSACTION_SERIALIZABLE} }; }
Example 11
Source Project: gemfirexd-oss File: QueryPerfPrms.java License: Apache License 2.0 | 5 votes |
private static int getTxIsolation(Long key, String val) { if (val.equalsIgnoreCase("transaction_none") || val.equalsIgnoreCase("transactionNone") || val.equalsIgnoreCase("none")) { return TRANSACTION_NONE; } else { if (val.equalsIgnoreCase("transaction_read_uncommitted") || val.equalsIgnoreCase("transactionReadUncommitted") || val.equalsIgnoreCase("read_uncommitted") || val.equalsIgnoreCase("readUncommitted")) { return Connection.TRANSACTION_READ_UNCOMMITTED; } else if (val.equalsIgnoreCase("transaction_read_committed") || val.equalsIgnoreCase("transactionReadCommitted") || val.equalsIgnoreCase("read_committed") || val.equalsIgnoreCase("readCommitted")) { return Connection.TRANSACTION_READ_COMMITTED; } else if (val.equalsIgnoreCase("transaction_repeatable_read") || val.equalsIgnoreCase("transactionRepeatableRead") || val.equalsIgnoreCase("repeatable_read") || val.equalsIgnoreCase("repeatableRead")) { return Connection.TRANSACTION_REPEATABLE_READ; } else if (val.equalsIgnoreCase("transaction_serializable") || val.equalsIgnoreCase("transactionSerializable") || val.equalsIgnoreCase("serializable")) { return Connection.TRANSACTION_SERIALIZABLE; } else { String s = "Illegal value for " + BasePrms.nameForKey(key) + ": " + val; throw new HydraConfigException(s); } } }
Example 12
Source Project: TencentKona-8 File: CommonRowSetTests.java License: GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "rowSetIsolationTypes") protected Object[][] rowSetIsolationTypes() throws Exception { RowSet rs = newInstance(); return new Object[][]{ {rs, Connection.TRANSACTION_NONE}, {rs, Connection.TRANSACTION_READ_COMMITTED}, {rs, Connection.TRANSACTION_READ_UNCOMMITTED}, {rs, Connection.TRANSACTION_REPEATABLE_READ}, {rs, Connection.TRANSACTION_SERIALIZABLE} }; }
Example 13
Source Project: openjdk-jdk8u-backup File: CommonRowSetTests.java License: GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "rowSetIsolationTypes") protected Object[][] rowSetIsolationTypes() throws Exception { RowSet rs = newInstance(); return new Object[][]{ {rs, Connection.TRANSACTION_NONE}, {rs, Connection.TRANSACTION_READ_COMMITTED}, {rs, Connection.TRANSACTION_READ_UNCOMMITTED}, {rs, Connection.TRANSACTION_REPEATABLE_READ}, {rs, Connection.TRANSACTION_SERIALIZABLE} }; }
Example 14
Source Project: openjdk-jdk9 File: CommonRowSetTests.java License: GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "rowSetIsolationTypes") protected Object[][] rowSetIsolationTypes() throws Exception { RowSet rs = newInstance(); return new Object[][]{ {rs, Connection.TRANSACTION_NONE}, {rs, Connection.TRANSACTION_READ_COMMITTED}, {rs, Connection.TRANSACTION_READ_UNCOMMITTED}, {rs, Connection.TRANSACTION_REPEATABLE_READ}, {rs, Connection.TRANSACTION_SERIALIZABLE} }; }
Example 15
Source Project: dubbox File: DatabaseStatusChecker.java License: Apache License 2.0 | 5 votes |
private String getIsolation(int i) { if (i == Connection.TRANSACTION_READ_COMMITTED) { return "READ_COMMITTED"; } if (i == Connection.TRANSACTION_READ_UNCOMMITTED) { return "READ_UNCOMMITTED"; } if (i == Connection.TRANSACTION_REPEATABLE_READ) { return "REPEATABLE_READ"; } if (i == Connection.TRANSACTION_SERIALIZABLE) { return "SERIALIZABLE)"; } return "NONE"; }
Example 16
Source Project: spliceengine File: RuntimeStatisticsParser.java License: GNU Affero General Public License v3.0 | 5 votes |
/** * Create a RuntimeStatistics object to parse the text and extract * information. * * @param rts * Runtime Statistics string * */ public RuntimeStatisticsParser(String rts) { statistics = rts; if (rts.indexOf(" at serializable isolation level ") != -1) isolationLevel = Connection.TRANSACTION_SERIALIZABLE; else if (rts.indexOf("at read uncommitted isolation level") != -1) isolationLevel = Connection.TRANSACTION_READ_UNCOMMITTED; else if (rts.indexOf("at read committed isolation level") != -1) isolationLevel = Connection.TRANSACTION_READ_COMMITTED; else if (rts.indexOf("at repeatable read isolation level") != -1) isolationLevel = Connection.TRANSACTION_REPEATABLE_READ; if (rts.indexOf("Distinct Scan ResultSet") > 0) { distinctScan = true; } if (rts.indexOf("Table Scan ResultSet") > 0) { tableScan = true; } indexScan = (rts.indexOf("Index Scan ResultSet") >= 0); indexRowToBaseRow = (rts.indexOf("Index Row to Base Row ResultSet") >= 0); lastKeyIndexScan = (rts.indexOf("Last Key Index Scan ResultSet") >= 0); if (rts.indexOf("Eliminate duplicates = true") > 0) { eliminatedDuplicates = true; } if (rts.indexOf("Scroll Insensitive ResultSet:") > 0) scrollInsensitive = true; qualifiers = findQualifiers(); startPosition = getStartPosition(); stopPosition = getStopPosition(); }
Example 17
Source Project: gemfirexd-oss File: RuntimeStatisticsParser.java License: Apache License 2.0 | 5 votes |
/** * Create a RuntimeStatistics object to parse the text and extract * information. * * @param rts * Runtime Statistics string * */ public RuntimeStatisticsParser(String rts) { statistics = rts; if (rts.indexOf(" at serializable isolation level ") != -1) isolationLevel = Connection.TRANSACTION_SERIALIZABLE; else if (rts.indexOf("at read uncommitted isolation level") != -1) isolationLevel = Connection.TRANSACTION_READ_UNCOMMITTED; else if (rts.indexOf("at read committed isolation level") != -1) isolationLevel = Connection.TRANSACTION_READ_COMMITTED; else if (rts.indexOf("at repeatable read isolation level") != -1) isolationLevel = Connection.TRANSACTION_REPEATABLE_READ; if (rts.indexOf("Distinct Scan ResultSet") > 0) { distinctScan = true; } if (rts.indexOf("Table Scan ResultSet") > 0) { tableScan = true; } indexScan = (rts.indexOf("Index Scan ResultSet") >= 0); indexRowToBaseRow = (rts.indexOf("Index Row to Base Row ResultSet") >= 0); if (rts.indexOf("Eliminate duplicates = true") > 0) { eliminatedDuplicates = true; } if (rts.indexOf("Scroll Insensitive ResultSet:") > 0) scrollInsensitive = true; qualifiers = findQualifiers(); }
Example 18
Source Project: dubbox-hystrix File: DatabaseStatusChecker.java License: Apache License 2.0 | 5 votes |
private String getIsolation(int i) { if (i == Connection.TRANSACTION_READ_COMMITTED) { return "READ_COMMITTED"; } if (i == Connection.TRANSACTION_READ_UNCOMMITTED) { return "READ_UNCOMMITTED"; } if (i == Connection.TRANSACTION_REPEATABLE_READ) { return "REPEATABLE_READ"; } if (i == Connection.TRANSACTION_SERIALIZABLE) { return "SERIALIZABLE)"; } return "NONE"; }
Example 19
Source Project: presto File: PrestoDatabaseMetaData.java License: Apache License 2.0 | 4 votes |
@Override public int getDefaultTransactionIsolation() throws SQLException { return Connection.TRANSACTION_READ_UNCOMMITTED; }
Example 20
Source Project: CloverETL-Engine File: MSAccessConnection.java License: GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void optimizeConnection(OperationType operationType) throws Exception { switch (operationType) { case READ: connection.setAutoCommit(false); connection.setReadOnly(true); break; case WRITE: case CALL: connection.setAutoCommit(false); connection.setReadOnly(false); break; case TRANSACTION: connection.setAutoCommit(true); connection.setReadOnly(false); break; } //it's not possible to set transaction isolation level //log the message about it String transactionIsolationLevel = ""; switch (connection.getTransactionIsolation()) { case Connection.TRANSACTION_NONE: transactionIsolationLevel = "TRANSACTION_NONE"; break; case Connection.TRANSACTION_READ_COMMITTED: transactionIsolationLevel = "TRANSACTION_READ_COMMITTED"; break; case Connection.TRANSACTION_READ_UNCOMMITTED: transactionIsolationLevel = "TRANSACTION_READ_UNCOMMITTED"; break; case Connection.TRANSACTION_REPEATABLE_READ: transactionIsolationLevel = "TRANSACTION_REPEATABLE_READ"; break; case Connection.TRANSACTION_SERIALIZABLE: transactionIsolationLevel = "TRANSACTION_SERIALIZABLE"; break; } logger.warn("Transaction isolation level is set to " + transactionIsolationLevel + " and cannot be changed."); }