它应该类似于(取自liquibase.integration.spring.SpringLiquibase源代码):
java.sql.Connection c = YOUR_CONNECTION;Liquibase liquibase = null;try { Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(c)) liquibase = new Liquibase(YOUR_CHANGELOG, new FileSystemResourceAccessor(), database); liquibase.update();} catch (SQLException e) { throw new DatabaseException(e);} finally { if (c != null) { try { c.rollback(); c.close(); } catch (SQLException e) { //nothing to do } }}ResourceAccessor有多种实现方式,具体取决于应如何找到更改日志文件。



