Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Cannot execute commands against an offline database when I am trying to connect Oracle offline

$
0
0
Below are the code which I am using: 
        
      private static String file="create-table.yml";
public static void main(String[] args) throws Exception {
Database database =createOfflineDatabase("offline:oracle");
Liquibase liquibase = new Liquibase(file, new ClassLoaderResourceAccessor(), database);
liquibase.update("test");
liquibase.dropAll();
}
private static Database createOfflineDatabase(String url) throws Exception {
              DatabaseConnection databaseConnection = new OfflineConnection(url, new ClassLoaderResourceAccessor());
              return DatabaseFactory.getInstance().openDatabase(url, null, null, null, null);
        }

Getting this exception :

Exception in thread "main" liquibase.exception.MigrationFailedException: Migration failed for change set create-table.yml::create-table.yml::vishwakarma:
     Reason: liquibase.exception.DatabaseException: Cannot execute commands against an offline database
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:619)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:79)
at liquibase.Liquibase.update(Liquibase.java:214)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.Liquibase.update(Liquibase.java:188)
at liquibase.Liquibase.update(Liquibase.java:181)
at com.test.liquibase.LiquibaseTest.main(LiquibaseTest.java:27)

Can you guys please help me if I missing something? 

Thanks in Advance.

Viewing all articles
Browse latest Browse all 2993

Trending Articles