当前位置: 首页>>代码示例>>Java>>正文


Java Connection.TRANSACTION_READ_UNCOMMITTED属性代码示例

本文整理汇总了Java中java.sql.Connection.TRANSACTION_READ_UNCOMMITTED属性的典型用法代码示例。如果您正苦于以下问题:Java Connection.TRANSACTION_READ_UNCOMMITTED属性的具体用法?Java Connection.TRANSACTION_READ_UNCOMMITTED怎么用?Java Connection.TRANSACTION_READ_UNCOMMITTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.sql.Connection的用法示例。


在下文中一共展示了Connection.TRANSACTION_READ_UNCOMMITTED属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setTI

/**
 * Set Transaction Isolation level on the specified JDBC Connection
 */
public static void setTI(Connection c, String tiString)
        throws SQLException {
    int i = -1;
    if (tiString.equals("TRANSACTION_READ_UNCOMMITTED"))
        i = Connection.TRANSACTION_READ_UNCOMMITTED;
    if (tiString.equals("TRANSACTION_READ_COMMITTED"))
        i = Connection.TRANSACTION_READ_COMMITTED;
    if (tiString.equals("TRANSACTION_REPEATABLE_READ"))
        i = Connection.TRANSACTION_REPEATABLE_READ;
    if (tiString.equals("TRANSACTION_SERIALIZABLE"))
        i = Connection.TRANSACTION_SERIALIZABLE;
    if (tiString.equals("TRANSACTION_NONE"))
        i = Connection.TRANSACTION_NONE;
    if (i < 0) {
        throw new SQLException(
                "Trans. isol. value not supported by "
                + RCData.class.getName() + ": " + tiString);
    }
    c.setTransactionIsolation(i);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:23,代码来源:RCData.java

示例2: tiToString

/**
 * Return a String representation for the given numerical
 * java.sql.Connection Transaction level.
 * <P>
 * Database implementations are free to provide their own transaction
 * isolation levels, so you can't depend upon this method to much.
 * </P>
 * Returns null, since DB implementations are free to provide
 */
public static String tiToString(int ti) {
    switch (ti) {
        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";
        case Connection.TRANSACTION_NONE:
            return "TRANSACTION_NONE";
    }
    return "Custom Transaction Isolation numerical value: " + ti;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:24,代码来源:RCData.java

示例3: setTI

static public void setTI(Connection c, String tiString)
        throws SQLException {
    int i = -1;
    if (tiString.equals("TRANSACTION_READ_UNCOMMITTED"))
        i = Connection.TRANSACTION_READ_UNCOMMITTED;
    if (tiString.equals("TRANSACTION_READ_COMMITTED"))
        i = Connection.TRANSACTION_READ_COMMITTED;
    if (tiString.equals("TRANSACTION_REPEATABLE_READ"))
        i = Connection.TRANSACTION_REPEATABLE_READ;
    if (tiString.equals("TRANSACTION_SERIALIZABLE"))
        i = Connection.TRANSACTION_SERIALIZABLE;
    if (tiString.equals("TRANSACTION_NONE"))
        i = Connection.TRANSACTION_NONE;
    if (i < 0) {
        throw new SQLException(
                "Trans. isol. value not supported by "
                + RCData.class.getName() + ": " + tiString);
    }
    c.setTransactionIsolation(i);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:RCData.java

示例4: tiToString

/**
 * Return String for numerical java.sql.Connection Transaction level.
 *
 * Returns null, since DB implementations are free to provide
 * their own transaction isolation levels.
 */
static public String tiToString(int ti) {
    switch (ti) {
        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";
        case Connection.TRANSACTION_NONE:
            return "TRANSACTION_NONE";
    }
    return "Custom Transaction Isolation numerical value: " + ti;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:21,代码来源:RCData.java

示例5: testIsolationLevel

/**
 * Tests isolation level functionality
 * 
 * @throws Exception
 *             if an error occurs
 */
public void testIsolationLevel() throws Exception {
    if (versionMeetsMinimum(4, 0)) {
        String[] isoLevelNames = new String[] { "Connection.TRANSACTION_NONE", "Connection.TRANSACTION_READ_COMMITTED",
                "Connection.TRANSACTION_READ_UNCOMMITTED", "Connection.TRANSACTION_REPEATABLE_READ", "Connection.TRANSACTION_SERIALIZABLE" };

        int[] isolationLevels = new int[] { Connection.TRANSACTION_NONE, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_READ_UNCOMMITTED,
                Connection.TRANSACTION_REPEATABLE_READ, Connection.TRANSACTION_SERIALIZABLE };

        DatabaseMetaData dbmd = this.conn.getMetaData();

        for (int i = 0; i < isolationLevels.length; i++) {
            if (dbmd.supportsTransactionIsolationLevel(isolationLevels[i])) {
                this.conn.setTransactionIsolation(isolationLevels[i]);

                assertTrue(
                        "Transaction isolation level that was set (" + isoLevelNames[i]
                                + ") was not returned, nor was a more restrictive isolation level used by the server",
                        this.conn.getTransactionIsolation() == isolationLevels[i] || this.conn.getTransactionIsolation() > isolationLevels[i]);
            }
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:28,代码来源:ConnectionTest.java

示例6: rowSetIsolationTypes

@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}
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:CommonRowSetTests.java

示例7: getIsolation

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";
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:15,代码来源:DatabaseStatusChecker.java

示例8: getTransactionIsolation

private static int getTransactionIsolation(String actionValue) {

	if (actionValue.equals(HttpParameter.READ_UNCOMMITTED)) {
	    return Connection.TRANSACTION_READ_UNCOMMITTED;
	} else if (actionValue.equals(HttpParameter.READ_COMMITTED)) {
	    return Connection.TRANSACTION_READ_COMMITTED;
	} else if (actionValue.equals(HttpParameter.REPEATABLE_READ)) {
	    return Connection.TRANSACTION_REPEATABLE_READ;
	} else if (actionValue.equals(HttpParameter.SERIALIZABLE)) {
	    return Connection.TRANSACTION_SERIALIZABLE;
	} else {
	    throw new IllegalArgumentException(
		    "Unsupported Transaction Isolation Level: " + actionValue);
	}
    }
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:15,代码来源:TransactionUtil.java

示例9: supportsTransactionIsolationLevel

/**
 * Retrieves whether this database supports the given transaction isolation level.
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information</h3>
 * HSQLDB supports all levels.
 * </div>
 * <!-- end release-specific documentation -->
 *
 *
 * @param level one of the transaction isolation levels defined in
 *         <code>java.sql.Connection</code>
 * @return <code>true</code> if so; <code>false</code> otherwise
 * @exception SQLException if a database access error occurs
 * @see JDBCConnection
 */
public boolean supportsTransactionIsolationLevel(
        int level) throws SQLException {

    return level == Connection.TRANSACTION_READ_UNCOMMITTED
           || level == Connection.TRANSACTION_READ_COMMITTED
           || level == Connection.TRANSACTION_REPEATABLE_READ
           || level == Connection.TRANSACTION_SERIALIZABLE;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:25,代码来源:JDBCDatabaseMetaData.java

示例10: supportsTransactionIsolationLevel

/**
 * Retrieves whether this database supports the given transaction
 * isolation level. <p>
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information</h3>
 * HSQLDB supports <code>TRANSACTION_READ_UNCOMMITED</code> in all cases
 * and the rest of the isolation levels where there is only one connection
 * to the database.
 * </div>
 * <!-- end release-specific documentation -->
 *
 *
 * @param level one of the transaction isolation levels defined in
 *         <code>java.sql.Connection</code>
 * @return <code>true</code> if so; <code>false</code> otherwise
 * @exception SQLException if a database access error occurs
 * @see jdbcConnection
 */
public boolean supportsTransactionIsolationLevel(int level)
throws SQLException {

    return level == Connection.TRANSACTION_READ_UNCOMMITTED
           || level == Connection.TRANSACTION_READ_COMMITTED
           || level == Connection.TRANSACTION_REPEATABLE_READ
           || level == Connection.TRANSACTION_SERIALIZABLE;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:jdbcDatabaseMetaData.java

示例11: getDefaultTransactionIsolation

/**
 * Retrieves this database's default transaction isolation level.  The
 * possible values are defined in <code>java.sql.Connection</code>. <p>
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information</h3>
 *
 * Including 1.7.2, HSQLDB supports only TRANSACTION_READ_COMMITED
 * and <em>always</em> returns this value here.
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @return the default isolation level
 * @exception SQLException if a database access error occurs
 * @see jdbcConnection
 */
public int getDefaultTransactionIsolation() throws SQLException {
    return Connection.TRANSACTION_READ_UNCOMMITTED;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:jdbcDatabaseMetaData.java

示例12: supportsTransactionIsolationLevel

/**
 * Retrieves whether this database supports the given transaction
 * isolation level. <p>
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information</h3>
 * HSQLDB supports only <code>TRANSACTION_READ_UNCOMMITED</code>.
 * </div>
 * <!-- end release-specific documentation -->
 *
 *
 * @param level one of the transaction isolation levels defined in
 *         <code>java.sql.Connection</code>
 * @return <code>true</code> if so; <code>false</code> otherwise
 * @exception SQLException if a database access error occurs
 * @see jdbcConnection
 */
public boolean supportsTransactionIsolationLevel(int level)
throws SQLException {
    return level == Connection.TRANSACTION_READ_UNCOMMITTED;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:jdbcDatabaseMetaData.java

示例13: getDefaultTransactionIsolation

/**
 * Retrieves this database's default transaction isolation level.  The
 * possible values are defined in <code>java.sql.Connection</code>. <p>
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information</h3>
 *
 * Including 1.7.2, HSQLDB supports only TRANSACTION_READ_UNCOMMITED
 * and <em>always</em> returns this value here.
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @return the default isolation level
 * @exception SQLException if a database access error occurs
 * @see jdbcConnection
 */
public int getDefaultTransactionIsolation() throws SQLException {
    return Connection.TRANSACTION_READ_UNCOMMITTED;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:jdbcDatabaseMetaData.java


注:本文中的java.sql.Connection.TRANSACTION_READ_UNCOMMITTED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。