Example usage for java.sql Connection TRANSACTION_REPEATABLE_READ

List of usage examples for java.sql Connection TRANSACTION_REPEATABLE_READ

Introduction

In this page you can find the example usage for java.sql Connection TRANSACTION_REPEATABLE_READ.

Prototype

int TRANSACTION_REPEATABLE_READ

To view the source code for java.sql Connection TRANSACTION_REPEATABLE_READ.

Click Source Link

Document

A constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.

Usage

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetPgSql.CFInternetPgSqlSchema.java

public CFInternetPgSqlSchema(Connection argCnx) {
    super();/*from   w  ww .j  a v a 2s  .com*/
    cnx = argCnx;
    inTransaction = false;
    tableAuditAction = new CFInternetPgSqlAuditActionTable(this);
    tableCluster = new CFInternetPgSqlClusterTable(this);
    tableDomain = new CFInternetPgSqlDomainTable(this);
    tableDomainBase = new CFInternetPgSqlDomainBaseTable(this);
    tableHostNode = new CFInternetPgSqlHostNodeTable(this);
    tableISOCountry = new CFInternetPgSqlISOCountryTable(this);
    tableISOCountryCurrency = new CFInternetPgSqlISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFInternetPgSqlISOCountryLanguageTable(this);
    tableISOCurrency = new CFInternetPgSqlISOCurrencyTable(this);
    tableISOLanguage = new CFInternetPgSqlISOLanguageTable(this);
    tableISOTimezone = new CFInternetPgSqlISOTimezoneTable(this);
    tableMajorVersion = new CFInternetPgSqlMajorVersionTable(this);
    tableMimeType = new CFInternetPgSqlMimeTypeTable(this);
    tableMinorVersion = new CFInternetPgSqlMinorVersionTable(this);
    tableProjectBase = new CFInternetPgSqlProjectBaseTable(this);
    tableRealProject = new CFInternetPgSqlRealProjectTable(this);
    tableSecApp = new CFInternetPgSqlSecAppTable(this);
    tableSecDevice = new CFInternetPgSqlSecDeviceTable(this);
    tableSecForm = new CFInternetPgSqlSecFormTable(this);
    tableSecGroup = new CFInternetPgSqlSecGroupTable(this);
    tableSecGroupForm = new CFInternetPgSqlSecGroupFormTable(this);
    tableSecGroupInclude = new CFInternetPgSqlSecGroupIncludeTable(this);
    tableSecGroupMember = new CFInternetPgSqlSecGroupMemberTable(this);
    tableSecSession = new CFInternetPgSqlSecSessionTable(this);
    tableSecUser = new CFInternetPgSqlSecUserTable(this);
    tableService = new CFInternetPgSqlServiceTable(this);
    tableServiceType = new CFInternetPgSqlServiceTypeTable(this);
    tableSubProject = new CFInternetPgSqlSubProjectTable(this);
    tableTSecGroup = new CFInternetPgSqlTSecGroupTable(this);
    tableTSecGroupInclude = new CFInternetPgSqlTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFInternetPgSqlTSecGroupMemberTable(this);
    tableTenant = new CFInternetPgSqlTenantTable(this);
    tableTld = new CFInternetPgSqlTldTable(this);
    tableTopDomain = new CFInternetPgSqlTopDomainTable(this);
    tableTopProject = new CFInternetPgSqlTopProjectTable(this);
    tableURLProtocol = new CFInternetPgSqlURLProtocolTable(this);
    tableVersion = new CFInternetPgSqlVersionTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFInternetPgSqlSchema-constructor",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityDb2LUW.CFSecurityDb2LUWSchema.java

public CFSecurityDb2LUWSchema(Connection argCnx) {
    super();//from   w  w  w  . j a  va  2 s. c o m
    cnx = argCnx;
    inTransaction = false;
    tableAuditAction = new CFSecurityDb2LUWAuditActionTable(this);
    tableCluster = new CFSecurityDb2LUWClusterTable(this);
    tableHostNode = new CFSecurityDb2LUWHostNodeTable(this);
    tableISOCountry = new CFSecurityDb2LUWISOCountryTable(this);
    tableISOCountryCurrency = new CFSecurityDb2LUWISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFSecurityDb2LUWISOCountryLanguageTable(this);
    tableISOCurrency = new CFSecurityDb2LUWISOCurrencyTable(this);
    tableISOLanguage = new CFSecurityDb2LUWISOLanguageTable(this);
    tableISOTimezone = new CFSecurityDb2LUWISOTimezoneTable(this);
    tableSecApp = new CFSecurityDb2LUWSecAppTable(this);
    tableSecForm = new CFSecurityDb2LUWSecFormTable(this);
    tableSecGroup = new CFSecurityDb2LUWSecGroupTable(this);
    tableSecGroupForm = new CFSecurityDb2LUWSecGroupFormTable(this);
    tableSecGroupInclude = new CFSecurityDb2LUWSecGroupIncludeTable(this);
    tableSecGroupMember = new CFSecurityDb2LUWSecGroupMemberTable(this);
    tableSecSession = new CFSecurityDb2LUWSecSessionTable(this);
    tableSecUser = new CFSecurityDb2LUWSecUserTable(this);
    tableService = new CFSecurityDb2LUWServiceTable(this);
    tableServiceType = new CFSecurityDb2LUWServiceTypeTable(this);
    tableTSecGroup = new CFSecurityDb2LUWTSecGroupTable(this);
    tableTSecGroupInclude = new CFSecurityDb2LUWTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFSecurityDb2LUWTSecGroupMemberTable(this);
    tableTenant = new CFSecurityDb2LUWTenantTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(),
                "CFSecurityDb2LUWSchema-constructor", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityMySql.CFSecurityMySqlSchema.java

public CFSecurityMySqlSchema(Connection argCnx) {
    super();//from w w w .ja  v a2  s  .com
    cnx = argCnx;
    inTransaction = false;
    tableAuditAction = new CFSecurityMySqlAuditActionTable(this);
    tableCluster = new CFSecurityMySqlClusterTable(this);
    tableHostNode = new CFSecurityMySqlHostNodeTable(this);
    tableISOCountry = new CFSecurityMySqlISOCountryTable(this);
    tableISOCountryCurrency = new CFSecurityMySqlISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFSecurityMySqlISOCountryLanguageTable(this);
    tableISOCurrency = new CFSecurityMySqlISOCurrencyTable(this);
    tableISOLanguage = new CFSecurityMySqlISOLanguageTable(this);
    tableISOTimezone = new CFSecurityMySqlISOTimezoneTable(this);
    tableSecApp = new CFSecurityMySqlSecAppTable(this);
    tableSecForm = new CFSecurityMySqlSecFormTable(this);
    tableSecGroup = new CFSecurityMySqlSecGroupTable(this);
    tableSecGroupForm = new CFSecurityMySqlSecGroupFormTable(this);
    tableSecGroupInclude = new CFSecurityMySqlSecGroupIncludeTable(this);
    tableSecGroupMember = new CFSecurityMySqlSecGroupMemberTable(this);
    tableSecSession = new CFSecurityMySqlSecSessionTable(this);
    tableSecUser = new CFSecurityMySqlSecUserTable(this);
    tableService = new CFSecurityMySqlServiceTable(this);
    tableServiceType = new CFSecurityMySqlServiceTypeTable(this);
    tableTSecGroup = new CFSecurityMySqlTSecGroupTable(this);
    tableTSecGroupInclude = new CFSecurityMySqlTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFSecurityMySqlTSecGroupMemberTable(this);
    tableTenant = new CFSecurityMySqlTenantTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFSecurityMySqlSchema-constructor",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityPgSql.CFSecurityPgSqlSchema.java

public CFSecurityPgSqlSchema(Connection argCnx) {
    super();/*from  ww  w.  j av  a2  s.  c  o  m*/
    cnx = argCnx;
    inTransaction = false;
    tableAuditAction = new CFSecurityPgSqlAuditActionTable(this);
    tableCluster = new CFSecurityPgSqlClusterTable(this);
    tableHostNode = new CFSecurityPgSqlHostNodeTable(this);
    tableISOCountry = new CFSecurityPgSqlISOCountryTable(this);
    tableISOCountryCurrency = new CFSecurityPgSqlISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFSecurityPgSqlISOCountryLanguageTable(this);
    tableISOCurrency = new CFSecurityPgSqlISOCurrencyTable(this);
    tableISOLanguage = new CFSecurityPgSqlISOLanguageTable(this);
    tableISOTimezone = new CFSecurityPgSqlISOTimezoneTable(this);
    tableSecApp = new CFSecurityPgSqlSecAppTable(this);
    tableSecForm = new CFSecurityPgSqlSecFormTable(this);
    tableSecGroup = new CFSecurityPgSqlSecGroupTable(this);
    tableSecGroupForm = new CFSecurityPgSqlSecGroupFormTable(this);
    tableSecGroupInclude = new CFSecurityPgSqlSecGroupIncludeTable(this);
    tableSecGroupMember = new CFSecurityPgSqlSecGroupMemberTable(this);
    tableSecSession = new CFSecurityPgSqlSecSessionTable(this);
    tableSecUser = new CFSecurityPgSqlSecUserTable(this);
    tableService = new CFSecurityPgSqlServiceTable(this);
    tableServiceType = new CFSecurityPgSqlServiceTypeTable(this);
    tableTSecGroup = new CFSecurityPgSqlTSecGroupTable(this);
    tableTSecGroupInclude = new CFSecurityPgSqlTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFSecurityPgSqlTSecGroupMemberTable(this);
    tableTenant = new CFSecurityPgSqlTenantTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFSecurityPgSqlSchema-constructor",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfsecurity.v2_1.CFSecurityDb2LUW.CFSecurityDb2LUWSchema.java

public CFSecurityDb2LUWSchema(Connection argCnx) {
    super();//from   ww  w . j  ava  2  s  .  c  om
    cnx = argCnx;
    inTransaction = false;
    tableAuditAction = new CFSecurityDb2LUWAuditActionTable(this);
    tableCluster = new CFSecurityDb2LUWClusterTable(this);
    tableHostNode = new CFSecurityDb2LUWHostNodeTable(this);
    tableISOCountry = new CFSecurityDb2LUWISOCountryTable(this);
    tableISOCountryCurrency = new CFSecurityDb2LUWISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFSecurityDb2LUWISOCountryLanguageTable(this);
    tableISOCurrency = new CFSecurityDb2LUWISOCurrencyTable(this);
    tableISOLanguage = new CFSecurityDb2LUWISOLanguageTable(this);
    tableISOTimezone = new CFSecurityDb2LUWISOTimezoneTable(this);
    tableSecApp = new CFSecurityDb2LUWSecAppTable(this);
    tableSecDevice = new CFSecurityDb2LUWSecDeviceTable(this);
    tableSecForm = new CFSecurityDb2LUWSecFormTable(this);
    tableSecGroup = new CFSecurityDb2LUWSecGroupTable(this);
    tableSecGroupForm = new CFSecurityDb2LUWSecGroupFormTable(this);
    tableSecGroupInclude = new CFSecurityDb2LUWSecGroupIncludeTable(this);
    tableSecGroupMember = new CFSecurityDb2LUWSecGroupMemberTable(this);
    tableSecSession = new CFSecurityDb2LUWSecSessionTable(this);
    tableSecUser = new CFSecurityDb2LUWSecUserTable(this);
    tableService = new CFSecurityDb2LUWServiceTable(this);
    tableServiceType = new CFSecurityDb2LUWServiceTypeTable(this);
    tableTSecGroup = new CFSecurityDb2LUWTSecGroupTable(this);
    tableTSecGroupInclude = new CFSecurityDb2LUWTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFSecurityDb2LUWTSecGroupMemberTable(this);
    tableTenant = new CFSecurityDb2LUWTenantTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(),
                "CFSecurityDb2LUWSchema-constructor", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfsecurity.v2_1.CFSecurityMySql.CFSecurityMySqlSchema.java

public CFSecurityMySqlSchema(Connection argCnx) {
    super();//  w  ww  .  ja v  a2  s .com
    cnx = argCnx;
    inTransaction = false;
    tableAuditAction = new CFSecurityMySqlAuditActionTable(this);
    tableCluster = new CFSecurityMySqlClusterTable(this);
    tableHostNode = new CFSecurityMySqlHostNodeTable(this);
    tableISOCountry = new CFSecurityMySqlISOCountryTable(this);
    tableISOCountryCurrency = new CFSecurityMySqlISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFSecurityMySqlISOCountryLanguageTable(this);
    tableISOCurrency = new CFSecurityMySqlISOCurrencyTable(this);
    tableISOLanguage = new CFSecurityMySqlISOLanguageTable(this);
    tableISOTimezone = new CFSecurityMySqlISOTimezoneTable(this);
    tableSecApp = new CFSecurityMySqlSecAppTable(this);
    tableSecDevice = new CFSecurityMySqlSecDeviceTable(this);
    tableSecForm = new CFSecurityMySqlSecFormTable(this);
    tableSecGroup = new CFSecurityMySqlSecGroupTable(this);
    tableSecGroupForm = new CFSecurityMySqlSecGroupFormTable(this);
    tableSecGroupInclude = new CFSecurityMySqlSecGroupIncludeTable(this);
    tableSecGroupMember = new CFSecurityMySqlSecGroupMemberTable(this);
    tableSecSession = new CFSecurityMySqlSecSessionTable(this);
    tableSecUser = new CFSecurityMySqlSecUserTable(this);
    tableService = new CFSecurityMySqlServiceTable(this);
    tableServiceType = new CFSecurityMySqlServiceTypeTable(this);
    tableTSecGroup = new CFSecurityMySqlTSecGroupTable(this);
    tableTSecGroupInclude = new CFSecurityMySqlTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFSecurityMySqlTSecGroupMemberTable(this);
    tableTenant = new CFSecurityMySqlTenantTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFSecurityMySqlSchema-constructor",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfsecurity.v2_1.CFSecurityPgSql.CFSecurityPgSqlSchema.java

public CFSecurityPgSqlSchema(Connection argCnx) {
    super();//from w w w .ja  va 2 s .  c o  m
    cnx = argCnx;
    inTransaction = false;
    tableAuditAction = new CFSecurityPgSqlAuditActionTable(this);
    tableCluster = new CFSecurityPgSqlClusterTable(this);
    tableHostNode = new CFSecurityPgSqlHostNodeTable(this);
    tableISOCountry = new CFSecurityPgSqlISOCountryTable(this);
    tableISOCountryCurrency = new CFSecurityPgSqlISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFSecurityPgSqlISOCountryLanguageTable(this);
    tableISOCurrency = new CFSecurityPgSqlISOCurrencyTable(this);
    tableISOLanguage = new CFSecurityPgSqlISOLanguageTable(this);
    tableISOTimezone = new CFSecurityPgSqlISOTimezoneTable(this);
    tableSecApp = new CFSecurityPgSqlSecAppTable(this);
    tableSecDevice = new CFSecurityPgSqlSecDeviceTable(this);
    tableSecForm = new CFSecurityPgSqlSecFormTable(this);
    tableSecGroup = new CFSecurityPgSqlSecGroupTable(this);
    tableSecGroupForm = new CFSecurityPgSqlSecGroupFormTable(this);
    tableSecGroupInclude = new CFSecurityPgSqlSecGroupIncludeTable(this);
    tableSecGroupMember = new CFSecurityPgSqlSecGroupMemberTable(this);
    tableSecSession = new CFSecurityPgSqlSecSessionTable(this);
    tableSecUser = new CFSecurityPgSqlSecUserTable(this);
    tableService = new CFSecurityPgSqlServiceTable(this);
    tableServiceType = new CFSecurityPgSqlServiceTypeTable(this);
    tableTSecGroup = new CFSecurityPgSqlTSecGroupTable(this);
    tableTSecGroupInclude = new CFSecurityPgSqlTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFSecurityPgSqlTSecGroupMemberTable(this);
    tableTenant = new CFSecurityPgSqlTenantTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFSecurityPgSqlSchema-constructor",
                e);
    }
}

From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataLoggingHandler.java

/**
 * Handles given information.//from   w w w .j av a 2  s .  co m
 * @param metaData the database metadata.
 * @return <code>true</code> if the chain should be stopped.
 * @throws QueryJBuildException if the metadata cannot be logged.
 */
protected boolean handle(@NotNull final DatabaseMetaData metaData) throws QueryJBuildException {
    final boolean result = false;

    @Nullable
    Log t_Log = null;

    try {
        t_Log = UniqueLogFactory.getLog(DatabaseMetaDataLoggingHandler.class);

        if (t_Log != null) {
            t_Log.debug("Numeric functions:" + metaData.getNumericFunctions());

            t_Log.debug("String functions:" + metaData.getStringFunctions());

            t_Log.debug("System functions:" + metaData.getSystemFunctions());

            t_Log.debug("Time functions:" + metaData.getTimeDateFunctions());

            t_Log.debug("insertsAreDetected(TYPE_FORWARD_ONLY):"
                    + metaData.insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("insertsAreDetected(TYPE_SCROLL_INSENSITIVE):"
                    + metaData.insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("insertsAreDetected(TYPE_SCROLL_SENS):"
                    + metaData.insertsAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("isCatalogAtStart():" + metaData.isCatalogAtStart());

            t_Log.debug("isReadOnly():" + metaData.isReadOnly());

            /*
             * Fails for MySQL with a java.lang.AbstractMethodError 
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.locatorsUpdateCopy()
             t_Log.debug(
               "locatorsUpdateCopy():"
             + metaData.locatorsUpdateCopy());
             */

            t_Log.debug("nullPlusNonNullIsNull():" + metaData.nullPlusNonNullIsNull());

            t_Log.debug("nullsAreSortedAtEnd():" + metaData.nullsAreSortedAtEnd());

            t_Log.debug("nullsAreSortedAtStart():" + metaData.nullsAreSortedAtStart());

            t_Log.debug("nullsAreSortedHigh():" + metaData.nullsAreSortedHigh());

            t_Log.debug("nullsAreSortedLow():" + metaData.nullsAreSortedLow());

            t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("storesLowerCaseIdentifiers():" + metaData.storesLowerCaseIdentifiers());

            t_Log.debug("storesLowerCaseQuotedIdentifiers():" + metaData.storesLowerCaseQuotedIdentifiers());

            t_Log.debug("storesMixedCaseIdentifiers():" + metaData.storesMixedCaseIdentifiers());

            t_Log.debug("storesMixedCaseQuotedIdentifiers():" + metaData.storesMixedCaseQuotedIdentifiers());

            t_Log.debug("storesUpperCaseIdentifiers():" + metaData.storesUpperCaseIdentifiers());

            t_Log.debug("storesUpperCaseQuotedIdentifiers():" + metaData.storesUpperCaseQuotedIdentifiers());

            t_Log.debug("supportsAlterTableWithAddColumn():" + metaData.supportsAlterTableWithAddColumn());

            t_Log.debug("supportsAlterTableWithDropColumn():" + metaData.supportsAlterTableWithDropColumn());

            t_Log.debug("supportsANSI92EntryLevelSQL():" + metaData.supportsANSI92EntryLevelSQL());

            t_Log.debug("supportsANSI92FullSQL():" + metaData.supportsANSI92FullSQL());

            t_Log.debug("supportsANSI92IntermediateSQL():" + metaData.supportsANSI92IntermediateSQL());

            t_Log.debug("supportsBatchUpdates():" + metaData.supportsBatchUpdates());

            t_Log.debug(
                    "supportsCatalogsInDataManipulation():" + metaData.supportsCatalogsInDataManipulation());

            t_Log.debug(
                    "supportsCatalogsInIndexDefinitions():" + metaData.supportsCatalogsInIndexDefinitions());

            t_Log.debug("supportsCatalogsInPrivilegeDefinitions():"
                    + metaData.supportsCatalogsInPrivilegeDefinitions());

            t_Log.debug("supportsCatalogsInProcedureCalls():" + metaData.supportsCatalogsInProcedureCalls());

            t_Log.debug(
                    "supportsCatalogsInTableDefinitions():" + metaData.supportsCatalogsInTableDefinitions());

            t_Log.debug("supportsColumnAliasing():" + metaData.supportsColumnAliasing());

            t_Log.debug("supportsConvert():" + metaData.supportsConvert());

            t_Log.debug("supportsCoreSQLGrammar():" + metaData.supportsCoreSQLGrammar());

            t_Log.debug("supportsCorrelatedSubqueries():" + metaData.supportsCorrelatedSubqueries());

            t_Log.debug("supportsDataDefinitionAndDataManipulationTransactions():"
                    + metaData.supportsDataDefinitionAndDataManipulationTransactions());

            t_Log.debug("supportsDataManipulationTransactionsOnly():"
                    + metaData.supportsDataManipulationTransactionsOnly());

            t_Log.debug("supportsDifferentTableCorrelationNames():"
                    + metaData.supportsDifferentTableCorrelationNames());

            t_Log.debug("supportsExpressionsInOrderBy():" + metaData.supportsExpressionsInOrderBy());

            t_Log.debug("supportsExtendedSQLGrammar():" + metaData.supportsExtendedSQLGrammar());

            t_Log.debug("supportsFullOuterJoins():" + metaData.supportsFullOuterJoins());

            String t_strSupportsGetGeneratedKeys = Boolean.FALSE.toString();

            try {
                t_strSupportsGetGeneratedKeys = "" + metaData.supportsGetGeneratedKeys();
            } catch (@NotNull final SQLException sqlException) {
                t_strSupportsGetGeneratedKeys += sqlException.getMessage();
            }

            t_Log.debug("supportsGetGeneratedKeys():" + t_strSupportsGetGeneratedKeys);

            t_Log.debug("supportsGroupBy():" + metaData.supportsGroupBy());

            t_Log.debug("supportsGroupByBeyondSelect():" + metaData.supportsGroupByBeyondSelect());

            t_Log.debug("supportsGroupByUnrelated():" + metaData.supportsGroupByUnrelated());

            t_Log.debug("supportsIntegrityEnhancementFacility():"
                    + metaData.supportsIntegrityEnhancementFacility());

            t_Log.debug("supportsLikeEscapeClause():" + metaData.supportsLikeEscapeClause());

            t_Log.debug("supportsLimitedOuterJoins():" + metaData.supportsLimitedOuterJoins());

            t_Log.debug("supportsMinimumSQLGrammar():" + metaData.supportsMinimumSQLGrammar());

            t_Log.debug("supportsMixedCaseIdentifiers():" + metaData.supportsMixedCaseIdentifiers());

            t_Log.debug(
                    "supportsMixedCaseQuotedIdentifiers():" + metaData.supportsMixedCaseQuotedIdentifiers());

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsMultipleOpenResults()
             t_Log.debug(
               "supportsMultipleOpenResults():"
             + metaData.supportsMultipleOpenResults());
             */

            t_Log.debug("supportsMultipleResultSets():" + metaData.supportsMultipleResultSets());

            t_Log.debug("supportsMultipleTransactions():" + metaData.supportsMultipleTransactions());

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsNamedParameters()
             t_Log.debug(
               "supportsNamedParameters():"
             + metaData.supportsNamedParameters());
             */

            t_Log.debug("supportsNonNullableColumns():" + metaData.supportsNonNullableColumns());

            t_Log.debug("supportsOpenCursorsAcrossCommit():" + metaData.supportsOpenCursorsAcrossCommit());

            t_Log.debug("supportsOpenCursorsAcrossRollback():" + metaData.supportsOpenCursorsAcrossRollback());

            t_Log.debug(
                    "supportsOpenStatementsAcrossCommit():" + metaData.supportsOpenStatementsAcrossCommit());

            t_Log.debug("supportsOpenStatementsAcrossRollback():"
                    + metaData.supportsOpenStatementsAcrossRollback());

            t_Log.debug("supportsOrderByUnrelated():" + metaData.supportsOrderByUnrelated());

            t_Log.debug("supportsOuterJoins():" + metaData.supportsOuterJoins());

            t_Log.debug("supportsPositionedDelete():" + metaData.supportsPositionedDelete());

            t_Log.debug("supportsPositionedUpdate():" + metaData.supportsPositionedUpdate());

            t_Log.debug("supportsResultSetConcurrency(TYPE_FORWARD_ONLY,CONCUR_READ_ONLY):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY));

            t_Log.debug("supportsResultSetConcurrency(TYPE_FORWARD_ONLY,CONCUR_UPDATABLE):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY):"
                    + metaData.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE,
                            ResultSet.CONCUR_READ_ONLY));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE):"
                    + metaData.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE,
                            ResultSet.CONCUR_UPDATABLE));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE));

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsResultSetHoldability()
             t_Log.debug(
               "supportsResultSetHoldability("
             +     "HOLD_CURSORS_OVER_COMMIT):"
             + metaData.supportsResultSetHoldability(
             ResultSet.HOLD_CURSORS_OVER_COMMIT));
                    
             t_Log.debug(
               "supportsResultSetHoldability("
             +     "CLOSE_CURSORS_AT_COMMIT):"
             + metaData.supportsResultSetHoldability(
             ResultSet.CLOSE_CURSORS_AT_COMMIT));
             */

            t_Log.debug("supportsResultSetType(TYPE_FORWARD_ONLY):"
                    + metaData.supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("supportsResultSetType(TYPE_SCROLL_SENSITIVE):"
                    + metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE));

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsSavePoints()
             t_Log.debug(
               "supportsSavepoints():"
             + metaData.supportsSavepoints());
             */

            t_Log.debug("supportsSchemasInDataManipulation():" + metaData.supportsSchemasInDataManipulation());

            t_Log.debug("supportsSchemasInIndexDefinitions():" + metaData.supportsSchemasInIndexDefinitions());

            t_Log.debug("supportsSchemasInPrivilegeDefinitions():"
                    + metaData.supportsSchemasInPrivilegeDefinitions());

            t_Log.debug("supportsSchemasInProcedureCalls():" + metaData.supportsSchemasInProcedureCalls());

            t_Log.debug("supportsSchemasInTableDefinitions():" + metaData.supportsSchemasInTableDefinitions());

            t_Log.debug("supportsSelectForUpdate():" + metaData.supportsSelectForUpdate());

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsStatementPooling()
             t_Log.debug(
               "supportsStatementPooling():"
             + metaData.supportsStatementPooling());
            */

            t_Log.debug("supportsStoredProcedures():" + metaData.supportsStoredProcedures());

            t_Log.debug("supportsSubqueriesInComparisons():" + metaData.supportsSubqueriesInComparisons());

            t_Log.debug("supportsSubqueriesInExists():" + metaData.supportsSubqueriesInExists());

            t_Log.debug("supportsSubqueriesInIns():" + metaData.supportsSubqueriesInIns());

            t_Log.debug("supportsSubqueriesInQuantifieds():" + metaData.supportsSubqueriesInQuantifieds());

            t_Log.debug("supportsTableCorrelationNames():" + metaData.supportsTableCorrelationNames());

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_NONE):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_NONE));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_READ_COMMITTED):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_COMMITTED));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_READ_UNCOMMITTED):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_REPEATABLE_READ):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_REPEATABLE_READ));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_SERIALIZABLE):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE));

            t_Log.debug("supportsTransactions():" + metaData.supportsTransactions());

            t_Log.debug("supportsUnion():" + metaData.supportsUnion());

            t_Log.debug("supportsUnionAll():" + metaData.supportsUnionAll());

            t_Log.debug("updatesAreDetected(TYPE_FORWARD_ONLY):"
                    + metaData.updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("updatesAreDetected(TYPE_SCROLL_INSENSITIVE):"
                    + metaData.updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("updatesAreDetected(" + "TYPE_SCROLL_SENS):"
                    + metaData.updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("usesLocalFilePerTable():" + metaData.usesLocalFilePerTable());

            t_Log.debug("usesLocalFiles():" + metaData.usesLocalFiles());
        }
    } catch (@NotNull final SQLException sqlException) {
        t_Log.error("Database metadata request failed.", sqlException);
    }

    return result;
}

From source file:org.apache.hadoop.hive.metastore.MyXid.java

public boolean createDatabaseNoDistributeTransaction(Database db) throws MetaException {
    boolean success = false;
    Connection con;/*from   w ww  .  j a  v a 2s  . c  o m*/
    PreparedStatement ps = null;
    db.setName(db.getName().toLowerCase());

    if (db.getMetastore() == null) {
        String slaveURL = getSegmentUrlByDbNameHashCode(db.getName());
        db.setMetastore(slaveURL);
    }
    int hashcode = getHashForDb(db.getName());

    try {
        con = getConnectionFromPool(db.getMetastore());
    } catch (MetaStoreConnectException e1) {
        LOG.error("create database error, db=" + db.getName() + ", msg=" + e1.getMessage());
        throw new MetaException(e1.getMessage());
    } catch (SQLException e1) {
        LOG.error("create database error, db=" + db.getName() + ", msg=" + e1.getMessage());
        throw new MetaException(e1.getMessage());
    }

    try {
        con.setAutoCommit(false);
        con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);

        ps = con.prepareStatement("INSERT INTO DBS(name, hdfs_schema, description, owner) VALUES(?,?,?,?)");
        ps.setString(1, db.getName());
        ps.setString(2, db.getHdfsscheme());
        ps.setString(3, db.getDescription());
        ps.setString(4, db.getOwner());
        ps.executeUpdate();

        Warehouse wh = new Warehouse(hiveConf);
        Path databasePath = wh.getDefaultDatabasePath(db.getName(), db.getHdfsscheme());
        wh.mkdirs(databasePath);

        con.commit();
        success = true;

    } catch (Exception x) {
        LOG.error("create database error, db=" + db.getName() + ", msg=" + x.getMessage());
        x.printStackTrace();
        try {
            con.rollback();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        throw new MetaException(x.getMessage());
    } finally {
        closeStatement(ps);
        closeConnection(con);
    }

    try {
        con = getGlobalConnection();
    } catch (MetaStoreConnectException e1) {
        LOG.error("create database error, db=" + db.getName() + ", msg=" + e1.getMessage());
        throw new MetaException(e1.getMessage());
    } catch (SQLException e1) {
        LOG.error("create database error, db=" + db.getName() + ", msg=" + e1.getMessage());
        throw new MetaException(e1.getMessage());
    }

    try {
        con.setAutoCommit(false);
        con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);

        ps = con.prepareStatement("INSERT INTO router(db_name, seg_addr, hashcode, owner) VALUES(?,?,?,?)");
        ps.setString(1, db.getName());
        ps.setString(2, db.getMetastore());
        ps.setInt(3, hashcode);
        ps.setString(4, db.getOwner());
        ps.executeUpdate();

        con.commit();
    } catch (Exception x) {
        LOG.error("create database error, db=" + db.getName() + ", msg=" + x.getMessage());
        x.printStackTrace();
        try {
            con.rollback();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        throw new MetaException(x.getMessage());
    } finally {
        closeStatement(ps);
        closeConnection(con);
    }

    return success;
}

From source file:org.apache.hadoop.hive.metastore.MyXid.java

public boolean dropDatabaseNoDistributeTransaction(String name) throws MetaException {
    boolean success = false;
    Connection con;/* w ww  .  j a va  2  s.c o  m*/
    Statement stmt = null;
    name = name.toLowerCase();

    try {
        con = getSegmentConnection(name.toLowerCase());
    } catch (MetaStoreConnectException e1) {
        LOG.error("drop database error, db=" + name + ", msg=" + e1.getMessage());
        throw new MetaException(e1.getMessage());
    } catch (SQLException e1) {
        LOG.error("drop database error, db=" + name + ", msg=" + e1.getMessage());
        throw new MetaException(e1.getMessage());
    }

    try {
        con.setAutoCommit(false);
        con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);

        stmt = con.createStatement();
        String sql = "DELETE FROM dbs WHERE name='" + name + "'";
        stmt.executeUpdate(sql);

        Warehouse wh;
        wh = new Warehouse(hiveConf);
        wh.deleteDir(wh.getDefaultDatabasePath(name), true);

        con.commit();
        success = true;
    } catch (Exception x) {
        LOG.error("drop database error, db=" + name + ", msg=" + x.getMessage());
        throw new MetaException(x.getMessage());
    } finally {
        if (!success) {
            try {
                con.rollback();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        closeStatement(stmt);
        closeConnection(con);
    }

    success = false;
    try {
        con = getGlobalConnection();
    } catch (MetaStoreConnectException e1) {
        LOG.error("drop database error, db=" + name + ", msg=" + e1.getMessage());
        throw new MetaException(e1.getMessage());
    } catch (SQLException e1) {
        LOG.error("drop database error, db=" + name + ", msg=" + e1.getMessage());
        throw new MetaException(e1.getMessage());
    }

    try {
        con.setAutoCommit(false);
        con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);

        stmt = con.createStatement();
        String sql = "DELETE FROM router WHERE db_name='" + name + "'";
        stmt.executeUpdate(sql);

        sql = "delete from dbpriv where db_name='" + name + "'";
        stmt.executeUpdate(sql);

        sql = "delete from tblpriv where db_name='" + name + "'";
        stmt.executeUpdate(sql);

        try {
            sql = "delete from dbsensitivity where db_name='" + name + "'";
            stmt.executeUpdate(sql);

            sql = "delete from tblsensitivity where db_name='" + name + "'";
            stmt.executeUpdate(sql);
        } catch (Exception x) {

        }

        con.commit();
        success = true;
    } catch (SQLException x) {
        LOG.error("drop database error, db=" + name + ", msg=" + x.getMessage());
        throw new MetaException(x.getMessage());
    } finally {
        if (!success) {
            try {
                con.rollback();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        closeStatement(stmt);
        closeConnection(con);
    }

    return success;
}