Goal
To run liquibase against Informix quickly on your local system to reproduce and work support issues.
Methodology
Will be using Docker to create an Informix container. Install the version of liquibase you want to use (switch to the correct version if you have a side by side setup of multiple liquibase versions). Pull docker image from docker hub and docker run to run a docker registered Informix image.
Install liquibase
…. on your local system.
You can download the software here. I will be using side x side installs on a mac. So I downloaded the last few versions:
Ronaks-MacBook-Pro:opt root# pwd /usr/local/opt Ronaks-MacBook-Pro:opt root# mkdir liquibase-3.10.1 Ronaks-MacBook-Pro:opt root# tar -xzvf liquibase-3.10.1.tar.gz -C liquibase-3.10.1 ... drwxr-xr-x 9 root wheel 288B Jul 9 11:17 ./ drwxr-xr-x 6 root wheel 192B Jul 8 10:21 ../ lrwxr-xr-x 1 root wheel 16B Jul 9 11:17 liquibase@ -> liquibase-3.10.1 -rw-r--r--@ 1 ronak staff 7.0M Jun 29 17:08 liquibase-3.10.0.tar.gz drwxr-xr-x 14 root wheel 448B Jul 9 11:16 liquibase-3.10.1/ -rw-rw-rw-@ 1 ronak staff 7.1M Jul 8 14:44 liquibase-3.10.1.tar.gz -rw-rw-rw-@ 1 ronak staff 7.0M Jul 9 11:07 liquibase-3.8.9.tar.gz -rw-rw-rw-@ 1 ronak staff 7.0M Jul 9 11:06 liquibase-3.9.0.tar.gz -rw-rw-rw-@ 1 ronak staff 6.4M Jul 9 11:02 liquibase-4.0.0-beta2.tar.gz Ronaks-MacBook-Pro:opt root# which liquibase /usr/local/opt/liquibase/liquibase Ronaks-MacBook-Pro:opt root# liquibase --version Starting Liquibase at Thu, 09 Jul 2020 11:17:42 CDT (version 3.10.1 #17 built at Wed Jul 01 06:58:05 UTC 2020) Liquibase Version: 3.10.1 Liquibase Community 3.10.1 by Datical Running Java under /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/jre (Version 1.8.0_251)
Also note I downloaded the tar.gz not the dmg. I had some issues with that when switching versions so I just went for more control using tar.gz. and symlinks.
Running Informix via Docker.
I used these instructions from Docker Hub. These instructions only get you part way there, here’s what I did:
Run:
docker pull ibmcom/informix-developer-database
docker run --name ronakInformix -e DBSERVERNAME=dbserver -e LICENSE=accept -e LOCAL=true -p 9088:9088 -e DBA_USER=test -e DBA_PASS=test ibmcom/informix-developer-database
I had to create the testdb for this example, so open a docker bash session (after you run the above docker pull, the output should tell you how to open a docker bash session for this container, ex.
docker exec -it 55e1345371b4 bash
)run:
dbaccess
Select: Database
Select: Create
Create a database called testdb (you will also end up verifying your connection information here, I used
informix:in4mix
, seems like that is the image default)
Note, at the time this pulls down IBM Informix Dynamic Server Version 14.10.FC3DE.
Connect to Database
You can use sqlplus or a SQL Browser. I used DBeaver, and here was my connection config:
DBeaver
Prepare Databases/Schemas/objects
Now that we have a Docker container that is running Informix, and a test db named testdb.
Configure Liqubase Project
You can use any liquibase project you want, i use one I have committed to source
again, make sure you are in the root of ronak_lb_projects
cd ronak_lb_projects/informix
Make sure you install the jdbc driver for informix in the ronak_lb_projects/drivers folder
verify liquibase.properties file has URL and passwords correct, mine looked like this:
changeLogFile=infromixlog.xml #### Primary Database Information #### # The primary database is the database you want to use when doing an update, or for performing comparisons. # Enter the URL of the source database url=jdbc:informix-sqli://localhost:9088/testdb:INFORMIXSERVER=dbserver # Enter the username for your source database. username: informix # Enter the password for your source database. password: in4mix classpath: ../drivers/jdbc-4.50.4.1.jar logLevel: ERROR
test by running liquibase updateSQL, I used the following command:
liquibase updateSQL
note because of
Destroying the Docker Image
find your container by listing it:
docker container ls -a
Which should return something like this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4d5674c2da35 mssql "docker-entrypoint.s…" 2 days ago Up 2 days 0.0.0.0:5432->5432/tcp some-sqlserver
Use the container id to delete the image if you are done
docker stop <containerid> docker container rm <containerid>