java.sql.Connection#TRANSACTION_READ_UNCOMMITTED源码实例Demo

下面列出了java.sql.Connection#TRANSACTION_READ_UNCOMMITTED 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gemfirexd-oss   文件: QueryPerfPrms.java
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);
  }
}
 
源代码2 项目: gemfirexd-oss   文件: Converters.java
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;
  }
}
 
源代码3 项目: jaybird   文件: FBTpbMapper.java
/**
 * 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.");
    }
}
 
源代码4 项目: aceql-http   文件: TransactionUtil.java
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";
}
   }
 
源代码5 项目: gemfirexd-oss   文件: GFXDPrms.java
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);
    }
  }
}
 
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);
}
 
源代码7 项目: gemfirexd-oss   文件: Converters.java
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;
  }
}
 
源代码8 项目: gemfirexd-oss   文件: GFXDPrms.java
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);
  }
}
 
/**
 * 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;
}
 
源代码10 项目: hottub   文件: CommonRowSetTests.java
@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}
    };
}
 
源代码11 项目: gemfirexd-oss   文件: QueryPerfPrms.java
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);
    }
  }
}
 
源代码12 项目: TencentKona-8   文件: CommonRowSetTests.java
@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}
    };
}
 
源代码13 项目: openjdk-jdk8u-backup   文件: CommonRowSetTests.java
@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}
    };
}
 
源代码14 项目: openjdk-jdk9   文件: CommonRowSetTests.java
@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}
    };
}
 
源代码15 项目: dubbox   文件: DatabaseStatusChecker.java
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";
}
 
源代码16 项目: spliceengine   文件: RuntimeStatisticsParser.java
/**
 * 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();
}
 
源代码17 项目: gemfirexd-oss   文件: RuntimeStatisticsParser.java
/**
 * 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();
}
 
源代码18 项目: dubbox-hystrix   文件: DatabaseStatusChecker.java
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";
}
 
源代码19 项目: presto   文件: PrestoDatabaseMetaData.java
@Override
public int getDefaultTransactionIsolation()
        throws SQLException
{
    return Connection.TRANSACTION_READ_UNCOMMITTED;
}
 
源代码20 项目: CloverETL-Engine   文件: MSAccessConnection.java
@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.");
}