Java Code Examples for liquibase.database.Database#close()

The following examples show how to use liquibase.database.Database#close() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DbScriptUtil.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected static void closeDatabase(Database database, DatabaseConnection databaseConnection) {
    try {
        database.close();
        databaseConnection.close();
    } catch (Exception e) {
        System.out.println("Error closing db connection " + e.getMessage());
    }
}
 
Example 2
Source File: DbScriptUtil.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected static void closeDatabase(Database database, DatabaseConnection databaseConnection) {
    try {
        database.close();
        databaseConnection.close();
    } catch (Exception e) {
        System.out.println("Error closing db connection " + e.getMessage());
    }
}
 
Example 3
Source File: DatabaseConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
private void closeDatabase(Liquibase liquibase) {
    if (liquibase != null) {
        Database database = liquibase.getDatabase();
        if (database != null) {
            try {
                database.close();
            } catch (DatabaseException e) {
                LOGGER.warn("Error closing database", e);
            }
        }
    }
}
 
Example 4
Source File: DbScriptUtil.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected static void closeDatabase(Database database, DatabaseConnection databaseConnection) {
    try {
        database.close();
        databaseConnection.close();
    } catch (Exception e) {
        System.out.println("Error closing db connection " + e.getMessage());
    }
}
 
Example 5
Source File: DatabaseConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
private void closeDatabase(Liquibase liquibase) {
    if (liquibase != null) {
        Database database = liquibase.getDatabase();
        if (database != null) {
            try {
                database.close();
            } catch (DatabaseException e) {
                LOGGER.warn("Error closing database", e);
            }
        }
    }
}
 
Example 6
Source File: LiquibaseBasedSchemaManager.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected void closeDatabase(Liquibase liquibase) {
    if (liquibase != null) {
        Database database = liquibase.getDatabase();
        if (database != null) {
            // do not close the shared connection if a command context is currently active
            if (Context.getCommandContext() == null) {
                try {
                    database.close();
                } catch (DatabaseException e) {
                    logger.warn("Error closing database for {}", context, e);
                }
            }
        }
    }
}
 
Example 7
Source File: FormEngineConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
private void closeDatabase(Liquibase liquibase) {
    if (liquibase != null) {
        Database database = liquibase.getDatabase();
        if (database != null) {
            try {
                database.close();
            } catch (DatabaseException e) {
                logger.warn("Error closing database", e);
            }
        }
    }
}
 
Example 8
Source File: EventRegistryEngineConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
private void closeDatabase(Liquibase liquibase) {
    if (liquibase != null) {
        Database database = liquibase.getDatabase();
        if (database != null) {
            try {
                database.close();
            } catch (DatabaseException e) {
                logger.warn("Error closing database", e);
            }
        }
    }
}
 
Example 9
Source File: SQLEntityStoreMixin.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
private void applyLiquibaseChangelog( SQLDialect dialect ) throws SQLException, LiquibaseException
{
    Liquibase liquibase = liquibaseService.newConnectedLiquibase();
    Database db = liquibase.getDatabase();
    db.setObjectQuotingStrategy( ObjectQuotingStrategy.QUOTE_ALL_OBJECTS );
    try
    {
        if( !dialect.equals( SQLDialect.SQLITE ) )
        {
            if( db.supportsSchemas() )
            {
                db.setDefaultSchemaName( schema.getName() );
                db.setLiquibaseSchemaName( schema.getName() );
            }
            if( db.supportsCatalogs() )
            {
                db.setDefaultCatalogName( schema.getName() );
                db.setLiquibaseCatalogName( schema.getName() );
            }
        }
        liquibase.getChangeLogParameters().set( TABLE_NAME_LIQUIBASE_PARAMETER, table.getName() );
        liquibase.update( new Contexts() );
    }
    finally
    {
        db.close();
    }
}
 
Example 10
Source File: SingularityCuratorTestBase.java    From Singularity with Apache License 2.0 5 votes vote down vote up
@BeforeAll
public void setup() throws Exception {
  JerseyGuiceUtils.reset();
  singularityTestModule = new SingularityTestModule(useDBTests, customConfigSetup);

  singularityTestModule.getInjector().injectMembers(this);
  singularityTestModule.start();
  leaderCacheCoordinator.activateLeaderCache();
  configuration.setThreadpoolShutdownDelayInSeconds(0);
  if (useDBTests) {
    Handle handle = dbiProvider.get().open();
    handle.getConnection().setAutoCommit(true);

    Database database = DatabaseFactory
      .getInstance()
      .findCorrectDatabaseImplementation(new JdbcConnection(handle.getConnection()));

    Liquibase liquibase = new Liquibase(
      "singularity_test.sql",
      new FileSystemResourceAccessor(),
      database
    );
    liquibase.update((String) null);

    try {
      database.close();
      handle.close();
    } catch (Throwable t) {}
  }
}