# Use updateSQL command with custom java code

**URL:** <https://forum.liquibase.org/t/use-updatesql-command-with-custom-java-code/4849>\
**Category:** General Discussion\
**Created:** [November 27, 2020, 7:59am UTC](https://forum.liquibase.org/t/use-updatesql-command-with-custom-java-code/4849 "2020-11-27T07:59:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![trannhatanh91](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@trannhatanh91](https://forum.liquibase.org/u/trannhatanh91)\
**Post date:** [November 27, 2020, 7:59am UTC](https://forum.liquibase.org/t/use-updatesql-command-with-custom-java-code/4849/1 "2020-11-27T07:59:39Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![ronak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ronak/32/221_2.png) [@ronak](https://forum.liquibase.org/u/ronak)\
**Post date:** [December 21, 2020, 9:48pm UTC](https://forum.liquibase.org/t/use-updatesql-command-with-custom-java-code/4849/2 "2020-12-21T21:48:12Z")

</div>

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.

Ronak

---

<div class="post-metadata">

**Author:** ![cjj](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@cjj](https://forum.liquibase.org/u/cjj)\
**Post date:** [February 2, 2021, 10:40pm UTC](https://forum.liquibase.org/t/use-updatesql-command-with-custom-java-code/4849/3 "2021-02-02T22:40:50Z")

</div>

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)
