Use updateSQL command with custom java code

I want to implement Liquibase in my java application. I could use the update command by using:

Liquibase liquibase = new Liquibase(changelogFile, new ClassLoaderResourceAccessor(), database);
liquibase.update(new Contexts(), new LabelExpression());

Is there any way to do the same with updateSQL command? (I cann’t find updateSQL method in Liquibase class)
Thank you

Hi @trannhatanh91,

Good question, I believe @NathanVoxland / @MikeOlivas may know. What are you trying to do to read the liquibase updateSQL command? You could exec it and parse the output as well.


Pretty sure passing the Writer doesn’t commit and acts like that

StringWriter out = new StringWriter();
liquibase.update(new Contexts(), out);

Confusing because the method name is the same.

(at least in my experience)

1 Like