liquibase update fails for DB2 in version 4.7.0
See original GitHub issueEnvironment
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:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
I added a work-around to the PR’s description
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.