GithubHelp home page GithubHelp logo

liquibase-db2i's Introduction

Liquibase DB2 iSeries Extension Build and Test Extension

This is a Liquibase DB2 extension for iSeries support. DB2 iSeries enables Liquibase to connect to DB2 iSeries data sources.

Configuring the extension

These instructions will help you get the extension up and running on your local machine for development and testing purposes. This extension has a prerequisite of Liquibase core in order to use it. Liquibase core can be found at https://www.liquibase.org/download.

Liquibase CLI

Download the latest released Liquibase extension .jar file and place it in the liquibase/lib install directory. If you want to use another location, specify the extension .jar file in the classpath of your liquibase.properties file.

Maven

Specify the Liquibase extension in the <dependency> section of your POM file by adding the org.liquibase.ext dependency for the Liquibase plugin.

<plugin>
     <!--start with basic information to get Liquibase plugin:
     include <groupId>, <artifactID>, and <version> elements-->
     <groupId>org.liquibase</groupId>
     <artifactId>liquibase-maven-plugin</artifactId>
     <version>4.3.2</version>
     <configuration>
        <!--set values for Liquibase properties and settings
        for example, the location of a properties file to use-->
        <propertyFile>liquibase.properties</propertyFile>
     </configuration>
     <dependencies>
     <!--set up any dependencies for Liquibase to function in your
     environment for example, a database-specific plugin-->
            <dependency>
                 <groupId>org.liquibase.ext</groupId>
                 <artifactId>liquibase-db2i</artifactId>
                 <version>${liquibase-db2i.version}</version>
            </dependency>
         </dependencies>
      </plugin>

Java call

public class Application {
    public static void main(String[] args) {
        DB2iDatabase database = (DB2iDatabase) DatabaseFactory.getInstance().openDatabase(url, null, null, null, null);
        Liquibase liquibase = new Liquibase("liquibase/ext/changelog.generic.test.xml", new ClassLoaderResourceAccessor(), database);
        liquibase.update("");
    }
}

Contribution

To file a bug, improve documentation, or contribute code, follow our guidelines for contributing.

This step-by-step instructions will help you contribute code for the extension.

Once you have created a PR for this extension you can find the artifact for your build using the following link: https://github.com/liquibase/liquibase-db2i/actions/workflows/build.yml.

Documentation

Using Liquibase with DB2 LUW

Issue Tracking

Any issues can be logged in the Github issue tracker.

License

This project is licensed under the Apache License Version 2.0.

liquibase-db2i's People

Contributors

alecapp avatar dependabot-preview[bot] avatar dependabot[bot] avatar duilio82 avatar ecofred avatar filipelautert avatar github-actions[bot] avatar jandroav avatar jnewton03 avatar liquibot avatar mcred avatar molivasdat avatar nmelny avatar nvoxland avatar r2-lf avatar sayalim0412 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liquibase-db2i's Issues

DB2i supports modifying not null constraints

With a chanset that has the command addNotNullConstraint, when I run liquibase:update I got the error "DB2 versions less than 9 do not support modifying null constraints"

https://github.com/liquibase/liquibase/blob/master/liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetNullableGenerator.java (line 41)

The database is db2 for iseries version V7R1M0 and it support add not null constraint.

┆Issue is synchronized with this Jira Bug by Unito

New release?

Hi @nvoxland,

some very important changes have been done since this first (and only) release of this extension. Is is about time for releasing a new version?

Regards, Oliver

┆Issue is synchronized with this Jira Bug by Unito

We can't run CL commands in our deployments

When I run SQL using one of the IBM clients I am allowed to run a CL command. The same syntax used in Liquibase doesn't work. Is there another way to do the same thing?
Here is an example:
cl: GRTOBJAUT OBJ(/) OBJTYPE(*FILE) AUTL()
This works fine using IBM's ACS software .

┆Issue is synchronized with this Jira Bug by Unito

The package pulls liquibase-commercial in?

I've update from 4.26.0 to 4.27.0 and are able to reliable reproduce that this package pulls liquibase-commercial in now. That's breaks things at runtime for me, because it bundles Jackson in a version newer than the one I'm using, is needed by my outdated Spring app etc. I get all kinds of different error like NoSuchFieldError, MethodNotFoundException etc. because of the incompatibilities. Though, things heavily depend on the unpredictable order of the JARs in the classpath, under some environment things work without any error, under other they break instantly.

Switching between 4.26.0 and 4.27.0 reliably changes the following lines for me:

ths@LAP3738 MINGW64 ~/IdeaProjects/app-mediator (main)
$ mvn dependency:tree
[...]
[INFO] +- org.liquibase.ext:liquibase-db2i:jar:4.27.0:compile
[INFO] |  \- org.liquibase:liquibase-commercial:jar:4.27.0:compile

Do you have any explanation for this behaviour?

Thanks!

DB2 comments on table and columns not generated

in package liquibase.ext.db2i.sqlgenerator, classes SetColumnRemarksGeneratorDB2i and SetTableRemarksGeneratorDB2i seem to correctly use syntax "LABEL ON [TABLE|COLUMN]" but the resulting SQL does not use it.

Example :

<changeSet id="v1.0-03-remarks" author="db2i-liquibase-test">
  <createTable tableName="test" remarks="Some remark">
    <column name="test" type="int" remarks="Should see this" />
  </createTable>
  <addColumn tableName="test">
    <column name="other" type="int" remarks="Should see that" />
  </addColumn>
</changeSet>

produces (using 'updateSQL' target) :

-- Changeset database/v1.0/changelog-01.xml::v1.0-03-remarks::db2i-liquibase-test
CREATE TABLE test (test INTEGER);
COMMENT ON TABLE test IS 'Some remark';
COMMENT ON COLUMN test.test IS 'Should see this';
ALTER TABLE test ADD other INTEGER;
COMMENT ON COLUMN test.other IS 'Should see that';
INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, LIQUIBASE) VALUES ('v1.0-03-remarks', 'db2i-liquibase-test', 'database/v1.0/changelog-01.xml', CURRENT TIMESTAMP, 3, '7:d02b30417f8eb72fa086e320e1fa172c', 'createTable, addColumn', '', 'EXECUTED', '3.2.2');

Here's my configuration (maven based) :

<plugin>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-maven-plugin</artifactId>
  <executions>
    <execution>
      <phase>process-resources</phase>
      <goals>
        <goal>updateSQL</goal>
      </goals>
      <configuration>
        <changeLogFile>database/changelog-master.xml</changeLogFile>
        <databaseClass>liquibase.ext.db2i.database.DB2iDatabase</databaseClass>
        <url>jdbc:as400://host/base</url>
        <username>SOME_USERNAME</username>
        <password>SOME_PASSWORD</password>
        <logging>debug</logging>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <dependency>
        <groupId>net.sf.jt400</groupId>
        <artifactId>jt400-jdk6</artifactId>
        <version>7.7.1</version>
    </dependency>
  </dependencies>
</plugin>

Am I missing something (such as declaring somewhere the remarks generators ?)

┆Issue is synchronized with this Jira Bug by Unito

Does not work on IBM i 7.5

Hi,

This extension does not work on IBM i 7.5, the database name starts with "AS" and not "DB2 UDB for AS/400".

Regards
Dennis

Spring Support

Is there any guide to use liquibase-db2i with spring / spring boot?

DB2i Support broke with 3.1

From http://forum.liquibase.org/topic/getting-db2i-support-working-in-3-1#49382000001008001

Two DB2i specific code snippets have been deleted with commit 66905ca9:

  • in UniqueConstraintSnapshotGenerator.listColumns(). That one is easy to fix in the way you already mentioned, with a custom UniqueConstraintSnapshotGenerator.
  • in JdbcDatabaseSnaphot.CachingDatabaseMetaData.getUniqueConstraints(). If I understand you correctly you suggest to basically copy to getUniqueConstraints() functionality into a UniqueConstraintSnapshotGeneratorDB2i class and adapt it for DB2i compatibility (read: have it use the sql pasted from git history).

However the original implementation uses a ResultSetCache and ResultSetExtractor. These are package private classes, not available to an extension, probably for a good reason.

Also it feels wrong to have to copy all this functionality just to be able to supply a different SQL string.

┆Issue is synchronized with this Jira Bug by Unito

DB2 for i doesn't support renaming of columns

Trying to get Keycloak running on DB2 for i a blocking issue that I encounter, is this:
Reason: liquibase.exception.DatabaseException: [SQL0199] Keyword RENAME was not expected. Valid tokens: ADD LOG NOT SET DATA DROP ALTER CHECK APPEND ATTACH DETACH. [Failed SQL: (-199) ALTER TABLE "IFSKCTST".EVENT_ENTITY RENAME COLUMN TIME TO EVENT_TIME]

I propose adding an additional generator called RenameColumnGeneratorDB2i which is subclass of RenameColumnGenerator overriding,

    @Override
    public boolean supports(RenameColumnStatement statement, Database database) {
        return false;
    }

I could contribute this change myself through a pull request, if you are interested? Do I need to sign up for something before code PR can be integrated?

Breaking change introduced in v4.25.1 by changing workflows

Since version v4.25.1, liquibase-core has been removed from liquibase-db2i.
This is a breaking change, and should not be included in a patch update.
Note that this change is also not documented in the release notes.

Projects are impacted if they include liquibase-db2i and liquibase-core as a transitive dependency, and update their liquibase-db2i from v4.25.0 to v4.25.1. Then, liquibase-core is suddenly not on the classpath anymore and all sorts of things can go wrong.

The relevant commit: d7e9e5a#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8 (@jandroav)

P.S. each release contains release notes with a link to a diff/compare versions. This link is broken and does not work. For instance, the last release links to:
v4.25.1...v4.26.0
which makes it seem as if there are no changes. This should be:
liquibase-db2i-4.25.1...liquibase-db2i-4.26.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.