Search in sources :

Example 26 with JdbcConnection

use of liquibase.database.jvm.JdbcConnection in project libresonic by Libresonic.

the class SpringLiquibase method createDatabase.

@Override
protected Database createDatabase(Connection c, ResourceAccessor resourceAccessor) throws DatabaseException {
    DatabaseConnection liquibaseConnection;
    if (c == null) {
        log.warning("Null connection returned by liquibase datasource. Using offline unknown database");
        liquibaseConnection = new OfflineConnection("offline:unknown", resourceAccessor);
    } else {
        liquibaseConnection = new JdbcConnection(c);
    }
    DatabaseFactory factory = DatabaseFactory.getInstance();
    overrideHsqlDbImplementation(factory);
    Database database = factory.findCorrectDatabaseImplementation(liquibaseConnection);
    if (StringUtils.trimToNull(this.defaultSchema) != null) {
        database.setDefaultSchemaName(this.defaultSchema);
    }
    return database;
}
Also used : DatabaseFactory(liquibase.database.DatabaseFactory) Database(liquibase.database.Database) DatabaseConnection(liquibase.database.DatabaseConnection) JdbcConnection(liquibase.database.jvm.JdbcConnection) OfflineConnection(liquibase.database.OfflineConnection)

Aggregations

JdbcConnection (liquibase.database.jvm.JdbcConnection)26 DatabaseException (liquibase.exception.DatabaseException)15 SQLException (java.sql.SQLException)13 OfflineConnection (liquibase.database.OfflineConnection)11 DatabaseConnection (liquibase.database.DatabaseConnection)10 Connection (java.sql.Connection)8 Database (liquibase.database.Database)8 ResultSet (java.sql.ResultSet)7 Statement (java.sql.Statement)6 UnexpectedLiquibaseException (liquibase.exception.UnexpectedLiquibaseException)6 RawSqlStatement (liquibase.statement.core.RawSqlStatement)5 Driver (java.sql.Driver)3 ArrayList (java.util.ArrayList)3 Liquibase (liquibase.Liquibase)3 DatabaseFactory (liquibase.database.DatabaseFactory)3 Method (java.lang.reflect.Method)2 CallableStatement (java.sql.CallableStatement)2 PreparedStatement (java.sql.PreparedStatement)2 DataSource (javax.sql.DataSource)2 LiquibaseException (liquibase.exception.LiquibaseException)2