question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

liquibase update fails for DB2 in version 4.7.0

See original GitHub issue

Environment

Liquibase Version: 4.7.0 Liquibase Integration & Version: gradle Liquibase Extension(s) & Version:

  • liquibase-hibernate5:4.7.0,
  • liquibase-gradle-plugin:2.1.1

Database Vendor & Version: IBM DB2 11 (Linux) Operating System Type & Version: Windows 10

Description

Since the update of liquibase to 4.7.0 in our gradle build these liquibase-gradle tasks throw the same error: update, updateTestingRollback, rollBackCount against DB2. diffChangeLog is working, other where not tested/used.

There was no change to the changeset or build-script. The only thing that changed is the liquibase version (4.6.2 worked fine)

Liquibase is not able to determine the default schema. These messages appear:

  • INFORMATION [liquibase.database] Cannot check pg_settings
  • INFORMATION [liquibase.database] Error getting default schema

The problem is: Liquibase tries to read from a table PG_SETTINGS which does not exist. Googling yields that this table belongs to PosgreSQL databases, but we use IBM DB2, so I suppose our database is wrongly classified as a PosgreSQL. See “Actual Behavior” for the log.

Steps To Reproduce

gradlew update or gradlew updateTestingRollback or gradlew rollbackCount -PliquibaseCommandValue=1 or starting a spring-boot-application with liquibase enabled against DB2

Actual Behavior

The tasks update/updateTestingRollback/rollbackCount fail very early before even one changeset ran. This is reproducable for version 4.7.0 and not for 4.6.2 (working)

Here is the Log: ` [2022-01-12 12:29:09] INFORMATION [liquibase.database] Cannot check pg_settings com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=REDACTED.PG_SETTINGS, DRIVER=4.25.13 at com.ibm.db2.jcc.am.b6.a(b6.java:810) at com.ibm.db2.jcc.am.b6.a(b6.java:66) at com.ibm.db2.jcc.am.b6.a(b6.java:140) at com.ibm.db2.jcc.am.k3.c(k3.java:2824) at com.ibm.db2.jcc.am.k3.d(k3.java:2808) at com.ibm.db2.jcc.am.k3.a(k3.java:2234) at com.ibm.db2.jcc.t4.ab.i(ab.java:206) at com.ibm.db2.jcc.t4.ab.b(ab.java:96) at com.ibm.db2.jcc.t4.p.a(p.java:32) at com.ibm.db2.jcc.t4.av.i(av.java:150) at com.ibm.db2.jcc.am.k3.al(k3.java:2203) at com.ibm.db2.jcc.am.k3.a(k3.java:3330) at com.ibm.db2.jcc.am.k3.a(k3.java:737) at com.ibm.db2.jcc.am.k3.executeQuery(k3.java:716) at liquibase.database.core.PostgresDatabase.setConnection(PostgresDatabase.java:176) at liquibase.database.DatabaseFactory.findCorrectDatabaseImplementation(DatabaseFactory.java:121) at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:141) at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:92) at liquibase.integration.commandline.Main.doMigration(Main.java:1517) at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:398) at liquibase.Scope.lambda$child$0(Scope.java:180) at liquibase.Scope.child(Scope.java:189) at liquibase.Scope.child(Scope.java:179) at liquibase.Scope.child(Scope.java:158) at liquibase.integration.commandline.Main$1.run(Main.java:397) at liquibase.integration.commandline.Main$1.run(Main.java:221) at liquibase.Scope.child(Scope.java:189) at liquibase.Scope.child(Scope.java:165) at liquibase.integration.commandline.Main.run(Main.java:221) at liquibase.integration.commandline.Main.main(Main.java:164)

[2022-01-12 12:29:09] INFORMATION [liquibase.database] Error getting default schema liquibase.exception.DatabaseException: Error executing SQL select current_schema(): DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=END-OF-STATEMENT;ect current_schema();<table_expr>, DRIVER=4.25.13 at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:126) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:161) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:172) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:180) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:195) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:190) at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:365) at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:325) at liquibase.changelog.ChangeLogParameters.<init>(ChangeLogParameters.java:61) at liquibase.Liquibase.<init>(Liquibase.java:119) at liquibase.integration.commandline.Main.doMigration(Main.java:1677) at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:398) at liquibase.Scope.lambda$child$0(Scope.java:180) at liquibase.Scope.child(Scope.java:189) at liquibase.Scope.child(Scope.java:179) at liquibase.Scope.child(Scope.java:158) at liquibase.integration.commandline.Main$1.run(Main.java:397) at liquibase.integration.commandline.Main$1.run(Main.java:221) at liquibase.Scope.child(Scope.java:189) at liquibase.Scope.child(Scope.java:165) at liquibase.integration.commandline.Main.run(Main.java:221) at liquibase.integration.commandline.Main.main(Main.java:164) `

Expected/Desired Behavior

Liquibase should determine the schema on DB2 like it could in version 2.6.2 so that the tasks update/updateTestingRollback… can be used again.

Additional Context

We use liquibase integrated with gradle on our delevopment-PCs against a DB2 on Linux. The problem occured while starting a spring-boot-app wich uses the auto-update-feature from liquibase and is reproducible (see above) on the gradle command line. (Liquibase-CLI was not tested)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nvoxlandcommented, Jan 13, 2022

I added a work-around to the PR’s description

0reactions
kataggartcommented, Jan 24, 2022

You are most welcome! By the way, @MarcusZander-SPayment if you have ideas you’d like to see implemented, please check out the post here in the forum and we’d love to see you at the next Meetup on Feb 10 to talk more about future planning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release Notes | Liquibase Docs
Known Issues. In version 4.7.0, users that have "edb" in connection URLs but are not using EnterpriseDB experienced errors that caused Liquibase to...
Read more >
Liquibase Db2 configruation - Stack Overflow
liquibase 3.10.2 seems to work with Db2-LUW for me. Try making these changes, which are documented in the text file GETTING_STARTED.txt .
Read more >
liquibase/liquibase v4.7.1 on GitHub - NewReleases.io
In version 4.7.0, users that have "edb" in connection URLs but are not using EnterpriseDB experienced errors that caused Liquibase to misinterpret the ......
Read more >
Index (liquibase-root 3.8.6 API) - javadoc.io
Information about the database changelog lock which allows only one instance of Liquibase to attempt to update a database at a time.
Read more >
changelog.txt - GitHub
Note: changesets marked `failonerror=false`, do not count as error, ... Added DB2 on z/OS database type and Java classes for Liquibase - Upgrade...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found