Package org.rhq.core.db

Examples of org.rhq.core.db.DatabaseType


        validateAttributes();

        Set<String> foreignKeys;

        DatabaseType databaseType = getDatabaseType();
        if (databaseType instanceof OracleDatabaseType) {

            foreignKeys = findForeignKeys( //
                FIND_FOREIGN_KEYS_ORACLE, //
                table.toUpperCase(Locale.US), //
View Full Code Here


            log(MSG.getMsg(DbAntI18NResourceKeys.JAVA_TASK_EXECUTING, className));

            Class<?> javaTaskClass = Class.forName(className);
            DatabaseUpgradeTask javaTask = (DatabaseUpgradeTask) javaTaskClass.newInstance();

            DatabaseType db_type = getDatabaseType();
            Connection conn = getConnection();

            javaTask.execute(db_type, conn);
        } catch (Exception e) {
            throw new BuildException(MSG.getMsg(DbAntI18NResourceKeys.JAVA_TASK_ERROR, e), e);
View Full Code Here

        }

        validateAttributes();

        Connection conn = getConnection();
        DatabaseType db_type = getDatabaseType();

        try {
            log(MSG.getMsg(DbAntI18NResourceKeys.INSERT_EXECUTING, table, insertCmd));
            db_type.insert(conn, table, insertCmd);
        } catch (SQLException e) {
            if (dupFail || (e.getMessage().toLowerCase().indexOf("constraint") == -1)) {
                throw new BuildException(MSG.getMsg(DbAntI18NResourceKeys.SCHEMA_SPEC_TASK_FAILURE, "Insert", e), e);
            }
View Full Code Here

        // make sure the task has been defined properly
        validateAttributes();

        try {
            DatabaseType db_type = getDatabaseType();
            Connection conn = getConnection();

            log(MSG.getMsg(DbAntI18NResourceKeys.CREATE_SEQUENCE_EXECUTING, m_name,
                    m_initial, m_increment, m_seqIdCacheSize));
            db_type.createSequence(conn, m_name, m_initial, m_increment, m_seqIdCacheSize);
        } catch (Exception e) {
            throw new BuildException(MSG.getMsg(DbAntI18NResourceKeys.SCHEMA_SPEC_TASK_FAILURE, "CreateSequence", e), e);
        }

        return;
View Full Code Here

        if (!isDBTargeted()) {
            return;
        }

        try {
            DatabaseType db_type = getDatabaseType();
            Connection conn = getConnection();

            checkColumnExistence(conn, db_type);

            db_type.alterColumn(conn, table, column, columnType, defval, precision, nullable, reindex);
        } catch (Exception e) {
            throw new BuildException(MSG.getMsg(DbAntI18NResourceKeys.ALTER_COLUMN_ERROR, e), e);
        }
    }
View Full Code Here

            throw new BuildException(MSG.getMsg(DbAntI18NResourceKeys.SCHEMA_SPEC_TASK_TARGET_VERSION_WITHOUT_VENDOR,
                getTaskName(), targetDBVersion));
        }

        if (targetDBVendor != null) {
            DatabaseType db_type = getDatabaseType();

            if (!targetDBVendor.equalsIgnoreCase(db_type.getVendor())) {
                log(MSG.getMsg(DbAntI18NResourceKeys.SCHEMA_SPEC_TASK_VENDOR_MISMATCH, targetDBVendor, db_type
                    .getVendor()));
                return false;
            }

            if ((targetDBVersion != null) && !targetDBVersion.equalsIgnoreCase(db_type.getVersion())) {
                log(MSG.getMsg(DbAntI18NResourceKeys.SCHEMA_SPEC_TASK_VERSION_MISMATCH, targetDBVendor,
                    targetDBVersion, db_type.getVersion()));
                return false;
            }
        }

        return true;
View Full Code Here

        }

        validateAttributes();

        try {
            DatabaseType db_type = getDatabaseType();
            Connection conn = getConnection();
            boolean exists = db_type.checkColumnExists(conn, table, column);

            if (!exists) {
                return; // good for us, its already been deleted
            }

            log(MSG.getMsg(DbAntI18NResourceKeys.DELETING_COLUMN, column, table));

            db_type.deleteColumn(conn, table, column);
        } catch (Exception e) {
            throw new BuildException(MSG.getMsg(DbAntI18NResourceKeys.ERROR_DELETING_COLUMN, column, table, e), e);
        }
    }
View Full Code Here

        if (!isDBTargeted()) {
            return;
        }

        try {
            DatabaseType db_type = getDatabaseType();
            Connection conn = getConnection();

            log(MSG.getMsg(DbAntI18NResourceKeys.ADD_COLUMN_EXECUTING, table, column, columnType, precision));

            db_type.addColumn(conn, table, column, columnType, precision);
        } catch (Exception e) {
            throw new BuildException(MSG.getMsg(DbAntI18NResourceKeys.ADD_COLUMN_ERROR, e), e);
        }
    }
View Full Code Here

        }

        validateAttributes();

        Connection conn = getConnection();
        DatabaseType db_type = getDatabaseType();

        if (statements != null) {
            for (Statement statement : statements) {
                statement.init(conn, db_type);
                statement.execute();
View Full Code Here

        }

        validateAttributes();

        try {
            DatabaseType db_type = getDatabaseType();
            Connection conn = getConnection();
            boolean exists = db_type.checkColumnExists(conn, table, column);

            if (!exists) {
                throw new BuildException(MSG.getMsg(DbAntI18NResourceKeys.ERROR_UPDATING_NONEXISTING_COLUMN, column,
                    table));
            }

            log(MSG.getMsg(DbAntI18NResourceKeys.UPDATING_COLUMN, table, column, modifyCmd));

            db_type.updateColumn(conn, table, column, modifyCmd);
        } catch (Exception e) {
            throw new BuildException(MSG.getMsg(DbAntI18NResourceKeys.ERROR_UPDATING_COLUMN, column, table, e), e);
        }
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.db.DatabaseType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.