Package liquibase.database.jvm

Examples of liquibase.database.jvm.JdbcConnection


        return new ValidationErrors();
    }

    @Override
    public void execute(Database database) throws CustomChangeException {
        JdbcConnection conn = (JdbcConnection) database.getConnection();
        try {
            Statement stmt =
                    conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,
                            ResultSet.CONCUR_UPDATABLE);
            try {
                Map<Long, String> docToLocaleMap = new HashMap<Long, String>();
                String docLocaleSql =
                        "select doc.id, loc.localeId from HDocument doc, HLocale loc where doc.locale = loc.id";
View Full Code Here


    @Override
    public void execute(Database database) throws CustomChangeException {
        // (Only Open Id for now)
        if (dbAuthType.equals("OPENID")) {
            JdbcConnection conn = (JdbcConnection) database.getConnection();

            try {
                Statement stmt = conn.createStatement();
                PreparedStatement insertStmt =
                        conn.prepareStatement("insert into HCredentials "
                                + "(account_id, type, user, email, creationDate, lastChanged, versionNum) values"
                                + "(?, ?, ?, ?, ?, ?, ?)");
                ResultSet rset =
                        stmt.executeQuery("select acc.id, acc.username, p.email, acc.creationDate, acc.lastChanged "
                                + " from HAccount acc, HPerson p"
View Full Code Here

        return new ValidationErrors();
    }

    @Override
    public void execute(Database database) throws CustomChangeException {
        JdbcConnection conn = (JdbcConnection) database.getConnection();
        try {
            prepareStatements(conn);
            migrateAllRawContents();
        } catch (Exception e) {
            throw new CustomChangeException(e);
View Full Code Here

public class ValidateAccountPasswords implements CustomTaskChange {
    private int emptyPasswordsFound = 0;

    @Override
    public void execute(Database database) throws CustomChangeException {
        JdbcConnection conn = (JdbcConnection) database.getConnection();

        Statement stmt = null;
        ResultSet rset = null;
        try {
            stmt =
                    conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                            ResultSet.CONCUR_UPDATABLE);
            rset =
                    stmt.executeQuery("select id, username, passwordHash from HAccount");

            while (rset.next()) {
View Full Code Here

            sl.getPackages().remove("liquibase.ext");
            sl.getPackages().remove("liquibase.sdk");
        }

        LogFactory.setInstance(new LogWrapper());
        Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
        return new Liquibase(CHANGELOG, new ClassLoaderResourceAccessor(getClass().getClassLoader()), database);
    }
View Full Code Here

            ResourceAccessor clFO = new ClassLoaderResourceAccessor();
            ResourceAccessor fsFO = new FileSystemResourceAccessor();


            database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
            database.setDefaultSchemaName(getDefaultSchema());
            Liquibase liquibase = new Liquibase(getChangeLogFile(), new CompositeResourceAccessor(clFO, fsFO, threadClFO), database);

            @SuppressWarnings("unchecked")
            Enumeration<String> initParameters = servletContext.getInitParameterNames();
View Full Code Here

//            System.out.println("Connection has been created");
            if (connection == null) {
                throw new DatabaseException("Connection could not be created to " + url + " with driver " + driverObject.getClass().getName() + ".  Possibly the wrong driver for the given database URL");
            }

            return new JdbcConnection(connection);
        } catch (Exception e) {
            throw new DatabaseException(e);
        }
    }
View Full Code Here

    protected DatabaseConnection openConnection(ConnectionSupplier connectionConfig) {
        try {
            final String url = connectionConfig.getJdbcUrl();
            if (connectionsAttempted.containsKey(url)) {
                JdbcConnection connection = (JdbcConnection) connectionsByUrl.get(url);
                if (connection == null) {
                    return null;
                } else if (connection.getUnderlyingConnection().isClosed()){
                    connectionsByUrl.put(url, openDatabaseConnection(connectionConfig));
                }
                return connectionsByUrl.get(url);
            }
            connectionsAttempted.put(url, Boolean.TRUE);
View Full Code Here

        }
        if (connection == null) {
            throw new DatabaseException("Connection could not be created to " + url + " with driver " + driver.getClass().getName() + ".  Possibly the wrong driver for the given database URL");
        }

        return new JdbcConnection(connection);
    }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        Class.forName("org.hsqldb.jdbc.JDBCDriver");
        connection = DriverManager.getConnection("jdbc:hsqldb:mem:TESTDB" + System.currentTimeMillis(), "SA", "");
        database = new HsqlDatabase();
        database.setConnection(new JdbcConnection(connection));

//        Class.forName("com.mysql.jdbc.Driver");
//        connection = DriverManager.getConnection("jdbc:mysql://10.10.100.100/liquibase", "liquibase", "liquibase");
//        database = new MySQLDatabase();
//        database.setConnection(new JdbcConnection(connection));
View Full Code Here

TOP

Related Classes of liquibase.database.jvm.JdbcConnection

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.